![]() |
UtilsLite
Utilities for C++ programming
|
Class for solving the equation \( f(x) = 0 \) using various numerical methods. More...
#include <Utils_zeros.hh>
Public Member Functions | |
| Zeros ()=default | |
| ~Zeros ()=default | |
| void | set_max_iterations (Integer mit) |
| void | set_max_fun_evaluation (Integer mfev) |
| void | set_tolerance (Real tol) |
| Real | solve_Newton (Real x_guess, Zeros_base_fun< Real > *fun) |
| Real | solve_Chebyshev (Real x_guess, Zeros_base_fun< Real > *fun) |
| Real | solve_Halley (Real x_guess, Zeros_base_fun< Real > *fun) |
| Real | solve_Order4 (Real x_guess, Zeros_base_fun< Real > *fun) |
| Real | solve_Order8 (Real x_guess, Zeros_base_fun< Real > *fun) |
| Real | solve_Order16 (Real x_guess, Zeros_base_fun< Real > *fun) |
| Real | solve_Order32 (Real x_guess, Zeros_base_fun< Real > *fun) |
| Integer | used_iter () const |
| Integer | num_fun_eval () const |
| Real | tolerance () const |
| bool | converged () const |
Class for solving the equation \( f(x) = 0 \) using various numerical methods.
This class implements multiple solvers to find the roots of a given function. The available methods include:
For a detailed exploration of these methods, refer to the paper:
Utils::Zeros_base_fun.Usage Example
To use this class, first wrap your function in a derived class. For instance, for the function \( f(x) = x^2 - 2 \), you can define:
Next, instantiate the function and the solver. Then, call the desired method to find the root:
If the method converges, x_solution will contain the computed solution.