Function roots::find_roots_quartic [] [src]

pub fn find_roots_quartic<F: FloatType>(a4: F, a3: F, a2: F, a1: F, a0: F) -> Roots<F>

Solves a quartic equation a4*x4 + a3*x3 + a2*x2 + a1*x + a0 = 0.

Returned roots are ordered. Precision is about 5e-15 for f64, 5e-7 for f32.

Examples

use roots::find_roots_quartic;

let one_root = find_roots_quartic(1f64, 0f64, 0f64, 0f64, 0f64);
// Returns Roots::One([0f64]) as 'x^4 = 0' has one root 0

let two_roots = find_roots_quartic(1f32, 0f32, 0f32, 0f32, -1f32);
// Returns Roots::Two([-1f32, 1f32]) as 'x^4 - 1 = 0' has roots -1 and 1