pub fn solve_quartic<F>(a: F, b: F, c: F, d: F) -> [Complex<F>; 4]where
    F: BaseFloat,
Expand description

solve equation: $x^4 + ax^3 + bx^2 + cx + d = 0$.

Examples

use matext4cgmath::solver;
use num_complex::Complex;
const EPS: f64 = 1.0e-10;

let mut res = solver::solve_quartic(1.0, -7.0, -1.0, 6.0);
// Even in the case of real solutions, the order in the array is not guaranteed.
res.sort_by(|x, y| x.re.partial_cmp(&y.re).unwrap());
let ans = [Complex::from(-3.0), Complex::from(-1.0), Complex::from(1.0), Complex::from(2.0)];
res.iter().zip(ans).for_each(|(x, y)| {
    assert!(Complex::norm(x * x * x * x + x * x * x - 7.0 * x * x - x + 6.0) < EPS);
    assert!(Complex::norm(x - y) < EPS, "{x} {y}");
});