ModelicaBook icon indicating copy to clipboard operation
ModelicaBook copied to clipboard

Example of 2nd order derivative annotation is wrong

Open amoss opened this issue 2 years ago • 0 comments

The example in the Second Derivatives subsection places the annotation on the wrong function.

function f
  …
  annotation(derivative=df, derivative(order=2)=ddf);
end f;

This is covered in §12.7 of the Modelica spec: https://modelica.org/documents/ModelicaSpec32Revision2.pdf, Where they give the example

function foo0
  annotation(derivative=foo1);
end foo0;
function foo1
  annotation(derivative(order=2)=foo2);
end foo1;
function foo2
end foo2;

Translated back onto your example, the derivative(order=2)=ddf annotation should be in the function df, rather than in f.

The body of the text in the spec does not make this entirely clear, but there are some lengthy discussions about it in relevant github issues.

amoss avatar Mar 15 '22 06:03 amoss