KrisLibrary  1.0.0
root.h
Go to the documentation of this file.
1 #ifndef MATH_ROOT_H
2 #define MATH_ROOT_H
3 
4 #include "function.h"
5 
11 namespace Math {
14 
15 enum ConvergenceResult { ConvergenceX, ConvergenceF, Divergence, LocalMinimum, MaxItersReached, ConvergenceError };
16 
17 std::ostream& operator<<(std::ostream&, ConvergenceResult r);
18 
26 ConvergenceResult Root_Bisection(RealFunction& f,Real& a, Real& b, Real& x, Real tol);
27 
32 ConvergenceResult Root_Secant(RealFunction& f,Real x0, Real& x1, int& maxIters, Real tolx, Real tolf);
33 
36 ConvergenceResult Root_SecantBracket(RealFunction& f,Real& a, Real& b, Real& x, int& maxIters, Real tolx, Real tolf);
37 
44 ConvergenceResult Root_Newton(RealFunction& f,Real& x, int& maxIters, Real tolx, Real tolf);
45 
47 ConvergenceResult Root_NewtonBracket(RealFunction& f,Real a, Real b, Real& x, int& maxIters, Real tolx, Real tolf);
48 
50 ConvergenceResult Root_Newton(ScalarFieldFunction& f,const Vector& x0, Vector& x, int& maxIters, Real tolx, Real tolf);
51 
52 
54 ConvergenceResult Root_Newton(VectorFieldFunction& f,const Vector& x0, Vector& x, int& maxIters, Real tolx, Real tolf);
55 
57 } // namespace Math
58 
59 #endif
Abstract base classes for function interfaces.
ConvergenceResult Root_Bisection(RealFunction &f, Real &a, Real &b, Real &x, Real tol)
Uses bisection to bracket f&#39;s root.
Definition: root.cpp:23
ConvergenceResult Root_NewtonBracket(RealFunction &f, Real a, Real b, Real &x, int &iters, Real tolx, Real tolf)
Same as above, but the interval [a,b] must be known to contain a root.
Definition: root.cpp:131
ConvergenceResult Root_Secant(RealFunction &f, Real x0, Real &x1, int &iters, Real tolx, Real tolf)
Uses the secant method to search for f&#39;s root.
Definition: root.cpp:54
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12
ConvergenceResult Root_SecantBracket(RealFunction &f, Real &a, Real &b, Real &x, int &iters, Real tolx, Real tolf)
Definition: root.cpp:78
ConvergenceResult Root_Newton(RealFunction &f, Real &x, int &iters, Real tolx, Real tolf)
Performs Newton&#39;s method, which uses the derivative of f to search for it&#39;s root. ...
Definition: root.cpp:111