function
Polynomials.fallingFactorial
n*(n-1)*...*(n-order+1)
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | n | Integer | (min=0) | |
| input | order | Integer | (min=0) | |
| output | value | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function fallingFactorial "n*(n-1)*...*(n-order+1)"
input Integer n(min=0);
input Integer order(min=0);
output Real value;
algorithm
value := 1.0;
if order > n then
value := 0.0;
else
for factorIndex in 0:order - 1 loop
value := value * (n - factorIndex);
end for;
end if;
end fallingFactorial;