functionrootsPolyOrder3
Find the roots of a 3 order polynome of kind ax3 + bx2 + cx + d = 0
Extends from Modelica.Icons.Function (Icon for functions).
Information
This function computes the vector of roots, roots=(x1, x2, x3}, of third order polynom P(x):
The process to get the roots derives from CARDAN's method available at the following link. To sum up:
If 'a' is bellow 1e-10, the polynom is assumed to be 2nd order
The discriminant of the second order polynom derives:
- If Δ > 0, the two real roots derives.
If 'a' and 'b' are bellow 1e-10, the polynom is assumed to be 1st order
The first root derives:
In case where a roots has no assigned value, its default value is 0.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | a | Polynom coefficients | |
| Real | b | Polynom coefficients | |
| Real | c | Polynom coefficients | |
| Real | d | Polynom coefficients |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[3] | roots |