Function roots::find_roots_cubic_depressed [] [src]

pub fn find_roots_cubic_depressed<F: FloatType>(a1: F, a0: F) -> Roots<F>

Solves a depressed cubic equation x3 + a1*x + a0 = 0.

In case more than one roots are present, they are returned in the increasing order.

Examples

use roots::find_roots_cubic_depressed;

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

let three_roots = find_roots_cubic_depressed(-1f32, 0f32);
// Returns Roots::Three([-1f32, -0f32, 1f32]) as 'x^3 - x = 0' has roots -1, 0, and 1