functionccubicRoots
Analytical solution for the roots of a cubic equation (a*x^3+b*x^2+c*x+d=0)
Information
Return roots[3] where each root is complex (i.e., has both roots[*].re and roots[*].im ).
nRoots helps to identify the number of expected real roots based on the result from the polynomial discriminant, D.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | a | ||
| Real | b | ||
| Real | c | ||
| Real | d |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Complex | roots | Real roots | |
| Real | nRoots | Number of distinct real solutions expected |