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