function
Polynomials.evaluateDerivative
Evaluate any derivative of a power-basis polynomial
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | coefficient | Real | [:] | Increasing power order |
| input | abscissa | Real | | |
| input | derivativeOrder | Integer | (min=0) = 0 | |
| output | value | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function evaluateDerivative
"Evaluate any derivative of a power-basis polynomial"
input Real coefficient[:] "Increasing power order";
input Real abscissa;
input Integer derivativeOrder(min=0) = 0;
output Real value;
protected
Integer power;
algorithm
value := 0.0;
for coefficientIndex in 1:size(coefficient, 1) loop
power := coefficientIndex - 1;
if power >= derivativeOrder then
value := value + coefficient[coefficientIndex]
* Polynomials.fallingFactorial(power, derivativeOrder)
* abscissa^(power - derivativeOrder);
end if;
end for;
end evaluateDerivative;