For high-order polynomials, this is more computationally efficient than the form Σai xn + i - 1.
Note that the order of the polynomial is
n + size(a, 1) - 1
(not n
).
The derivative of this function is df().
function f extends Modelica.Icons.Function; input Real x "Argument" annotation( Dialog(__Dymola_label = "<html><i>x</i></html>")); input Real a[:] "Coefficients" annotation( Dialog(__Dymola_label = "<html><i>a</i></html>")); input Integer n = 0 "Power of the first term" annotation( Dialog(__Dymola_label = "<html><i>n</i></html>")); output Real f "Result" annotation( Dialog(__Dymola_label = "<html><i>f</i></html>")); end f;