#include <secant.h>
Public Member Functions | |
secant_root_finder (Function &f, unsigned int iterations=100, double relative_error=1.0e-15) | |
double | find_root (double x0, double x1) |
typedef double function(double); num::secant_root_finder<function> finder(std::sin);
find the root around 3 and 4. double pi = finder.find_root(3.0, 4.0);
find the root around -1 and 1. double zero = finder.find_root(-1.0, 1.0);
References:
secant_root_finder< Function >::secant_root_finder | ( | Function & | f, | |
unsigned int | iterations = 100 , |
|||
double | relative_error = 1.0e-15 | |||
) | [inline] |
Create a root finder with the given function functor.
f | the function functor. | |
iterations | the maximum number of iterations. | |
relative_error | the maximum allowable relative error. |
double secant_root_finder< Function >::find_root | ( | double | x0, | |
double | x1 | |||
) | [inline] |
Find a root of the target function that lies around the two initial approximations, x0
and x1
.
x0 | an initial approximation to the root. | |
x1 | another initial approximation to the root. |
x0
and x1
.