Expand description
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§
- Debug
Convergency - Convergency provider for debugging. It will print out the error at each iteration.
- Interval
- Interval between two samples, including these samples
- Parabola
- Definition of the quadratic equation ax^2 + bx + c
- Sample
- Pair of the independent variable x and the function value y=F(x)
- Simple
Convergency - 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.
- Search
Error - Possible errors
Traits§
- Convergency
- The way to check if the algorithm has finished by either finding a root or reaching the iteration limit.
- Float
Type - 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_ inverse_ quadratic - Find a root of the function f(x) = 0 using inverse quadratic approximation.
- 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 a4x^4 + a2x^2 + a0 = 0.
- find_
roots_ cubic - Solves a cubic equation a3x^3 + a2x^2 + a1*x + a0 = 0.
- find_
roots_ cubic_ depressed - Solves a depressed cubic equation x^3 + a1*x + a0 = 0.
- find_
roots_ cubic_ normalized - Solves a normalized cubic equation x^3 + a2x^2 + a1x + a0 = 0.
- find_
roots_ eigen - Find all roots of the normalized polynomial by finding eigen numbers of the corresponding matrix. (Converted from Java by stiv-yakovenko)
- find_
roots_ linear - Solves a linear equation a1*x + a0 = 0.
- find_
roots_ quadratic - Solves a quadratic equation a2x^2 + a1x + a0 = 0.
- find_
roots_ quartic - Solves a quartic equation a4x^4 + a3x^3 + a2x^2 + a1x + a0 = 0.
- find_
roots_ quartic_ depressed - Solves a depressed quartic equation x^4 + a2x^2 + a1x + a0 = 0.
- find_
roots_ sturm - Find all roots of the normalized polynomial x^n + a[0]*x^(n-1) + a[1]*x^(n-2) + … + a[n-1] = 0 using the Sturm’s theorem recursively.