#include <falseposition.h>
Public Member Functions | |
false_position_root_finder (Function &f, unsigned int iterations=100, double relative_error=1.0e-15) | |
double | find_root (double min, double max) |
typedef double function(double); num::false_position_root_finder<function> finder(std::sin);
find the root between 3 and 4. double pi = finder.find_root(3.0, 4.0);
find the root between -1 and 1. double zero = finder.find_root(-1.0, 1.0);
References:
false_position_root_finder< Function >::false_position_root_finder | ( | Function & | f, | |
unsigned int | iterations = 100 , |
|||
double | relative_error = 1.0e-15 | |||
) | [inline] |
Create a false position 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 false_position_root_finder< Function >::find_root | ( | double | min, | |
double | max | |||
) | [inline] |
Find a root of the target function that lies in the interval [min
, max
].
min | the lower bound of the search interval. | |
max | the upper bound of the search interval. |
min
and max
, inclusive.