pub fn solve_cubic(c0: f64, c1: f64, c2: f64, c3: f64) -> ArrayVec<f64, 3>
Expand description
Find real roots of cubic equation.
The implementation is not (yet) fully robust, but it does handle the case
where c3
is zero (in that case, solving the quadratic equation).
See: https://momentsingraphics.de/CubicRoots.html
That implementation is in turn based on Jim Blinn’s “How to Solve a Cubic Equation”, which is masterful.
Return values of x for which c0 + c1 x + c2 x² + c3 x³ = 0.