Theoretica
Mathematical Library
Loading...
Searching...
No Matches
roots.h File Reference

Root approximation of real functions. More...

Go to the source code of this file.

Namespaces

namespace  theoretica
 Main namespace of the library which contains all functions and objects.
 

Functions

template<typename RealFunction , typename Bracket = vec2>
std::vector< Bracket > theoretica::find_root_brackets (RealFunction f, real a, real b, unsigned int steps=10)
 Find candidate intervals for root finding by evaluating a function at equidistant points inside an interval [a, b] and checking its sign.
 
template<typename RealFunction >
iter_result< realtheoretica::root_bisect (RealFunction f, real a, real b, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_BISECTION_ITER)
 Find the root of a univariate real function using bisection inside a compact interval [a, b] where \(f(a) * f(b) < 0\).
 
template<typename RealFunction >
real theoretica::root_itp (RealFunction f, real a, real b, real tol=OPTIMIZATION_TOL, unsigned int n0=1, real k1=0.0)
 Find a root of a univariate real function using the ITP (Interpolate-Truncate-Project) method, by bracketing the zero inside a compact interval [a, b] where \(f(a) * f(b) < 0\).
 
template<typename RealFunction >
iter_result< realtheoretica::root_newton (RealFunction f, RealFunction Df, real guess=0.0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_NEWTON_ITER)
 Find a root of a univariate real function using Newton's method.
 
iter_result< realtheoretica::root_newton (dual(*f)(dual), real guess=0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_NEWTON_ITER)
 Find a root of a univariate real function using Newton's method, computing the derivative using automatic differentiation.
 
template<typename Type = real, typename ComplexFunction = std::function<complex<Type>(complex<Type>)>>
iter_result< complex< Type > > theoretica::root_newton (ComplexFunction f, ComplexFunction Df, complex< Type > guess, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_NEWTON_ITER)
 Find a root of a complex function using Newton's method.
 
template<typename RealFunction >
iter_result< realtheoretica::root_halley (RealFunction f, RealFunction Df, RealFunction D2f, real guess=0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_HALLEY_ITER)
 Find a root of a univariate real function using Halley's method.
 
iter_result< realtheoretica::root_halley (dual2(*f)(dual2), real guess=0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_HALLEY_ITER)
 Find a root of a univariate real function using Halley's method, leveraging automatic differentiation to compute the first and second derivatives of the function.
 
template<typename RealFunction >
iter_result< realtheoretica::root_steffensen (RealFunction f, real guess=0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_STEFFENSEN_ITER)
 Find a root of a univariate real function using Steffensen's method.
 
template<typename RealFunction >
real theoretica::root_chebyshev (RealFunction f, RealFunction Df, RealFunction D2f, real guess=0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_CHEBYSHEV_ITER)
 Find a root of a univariate real function using Chebyshev's method.
 
iter_result< realtheoretica::root_chebyshev (dual2(*f)(dual2), real guess=0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_CHEBYSHEV_ITER)
 Find a root of a univariate real function using Chebyshev's method, by computing the first and second derivatives using automatic differentiation.
 
template<typename RealFunction >
iter_result< realtheoretica::root_ostrowski (RealFunction f, RealFunction Df, real guess=0.0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_OSTROWSKI_ITER)
 Find a root of a univariate real function using Ostrowski's method.
 
template<typename RealFunction >
iter_result< realtheoretica::root_jarrat (RealFunction f, RealFunction Df, real guess=0.0, real tol=OPTIMIZATION_TOL, unsigned int max_iter=OPTIMIZATION_JARRAT_ITER)
 Find a root of a univariate real function using Jarrat's method.
 
template<typename RealFunction , typename Vector = vec<real>>
Vector theoretica::roots (RealFunction f, real a, real b, real tol=OPTIMIZATION_TOL, real steps=10)
 Find the roots of a univariate real function inside a given interval, by first searching for candidate intervals and then applying bracketing methods.
 
template<typename Field , typename Vector = vec<Field>>
Vector theoretica::roots_polynomial (const polynomial< Field > &p, real tolerance=OPTIMIZATION_TOL, unsigned int steps=0)
 Find all the roots of a polynomial.
 

Detailed Description

Root approximation of real functions.