Crate roots [] [src]

A set of functions to find real roots of numerical equations.

This crate contains various algorithms for numerical and analytical solving of 1-variable equations like f(x)=0. Only real roots are calculated. Multiple (double etc.) roots are considered as one root.

Use

Functions find_root_* try to find a root of any given closure function by iterative approximations. Conditions for success/failure can be customized by implementing the Convergency trait. Functions find_roots_* return all roots of several simple equations at once.

Structs

DebugConvergency

Convergency provider for debugging. It will print out the error at each iteration.

SimpleConvergency

A very basic convergency rules that must be sufficient for many cases. The absolute precision is the same for x and y axes, no relative precision.

Enums

Roots

Sorted and unique list of roots of an equation.

Traits

Convergency

The way to check if the algorithm has finished by either finding a root or reaching the iteration limit.

FloatType

Generic type that lists functions and constants needed in calculations. Default implementations for f32 and f64 are provided.

Functions

find_root_brent

Find a root of the function f(x) = 0 using the Brent method.

find_root_newton_raphson

Find a root of the function f(x) = 0 using the Newton-Raphson method.

find_root_regula_falsi

Find a root of the function f(x) = 0 using the Illinois modification of the regula falsi method.

find_root_secant

Find a root of the function f(x) = 0 using the secant method.

find_roots_biquadratic

Solves a bi-quadratic equation a4*x4 + a2*x2 + a0 = 0.

find_roots_cubic

Solves a cubic equation a3*x3 + a2*x2 + a1*x + a0 = 0.

find_roots_cubic_depressed

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

find_roots_cubic_normalized

Solves a normalized cubic equation x3 + a2*x2 + a1*x + a0 = 0.

find_roots_linear

Solves a linear equation a1*x + a0 = 0.

find_roots_quadratic

Solves a quadratic equation a2*x2 + a1*x + a0 = 0.

find_roots_quartic

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

find_roots_quartic_depressed

Solves a depressed quartic equation x4 + a2*x2 + a1*x + a0 = 0.