![]() |
UtilsLite
Utilities for C++ programming
|
Abstract base class for defining mathematical functions used in root-finding algorithms. More...
#include <Utils_zeros.hh>
Public Member Functions | |
virtual Real | eval (Real x) const =0 |
virtual Real | eval_D (Real x) const =0 |
virtual Real | eval_DD (Real x) const =0 |
virtual Real | eval_DDD (Real x) const =0 |
Real | operator() (Real x) const |
Real | D (Real x) const |
Real | DD (Real x) const |
Real | DDD (Real x) const |
Abstract base class for defining mathematical functions used in root-finding algorithms.
This class serves as a base interface for user-defined functions that can be evaluated and differentiated. It allows for the implementation of various numerical methods to find the roots of the equation \( f(x) = 0 \). Users must inherit from this class and implement the virtual methods to define their specific functions.
The class provides methods to evaluate the function itself as well as its first, second, and third derivatives, which are essential for many root-finding algorithms such as Newton-Raphson and Halley methods.
Template Parameter:
Real
: A numeric type representing the data type of the function's input and output, such as float
, double
, etc.Usage Example: To create a custom function, derive from this class and implement the required methods. Here is an example for the function \( f(x) = x^2 - 2 \):