UtilsLite
Utilities for C++ programming
Loading...
Searching...
No Matches
Utils::AlgoHNewton_base_fun< Real > Class Template Referenceabstract

Abstract base class for defining mathematical functions used in the zero search algorithm. More...

#include <Utils_AlgoHNewton.hh>

Public Member Functions

virtual Real eval (Real x) const =0
 
virtual Real D (Real x) const =0
 

Detailed Description

template<typename Real>
class Utils::AlgoHNewton_base_fun< Real >

Abstract base class for defining mathematical functions used in the zero search algorithm.

This class serves as a base interface for user-defined functions that can be evaluated. It allows for the implementation the numerical method to find the solution of the one dimensional equation \( f(x) = 0 \). Users must inherit from this class and implement the virtual method to define their specific functions.

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 \):

class Fun1 : public AlgoHNewton_base_fun<double> {
public:
double eval(double x) const override { return x*x - 2; }
double D (double x) const override { return 2*x; }
};
Abstract base class for defining mathematical functions used in the zero search algorithm.
Definition Utils_AlgoHNewton.hh:81
virtual Real eval(Real x) const =0
virtual Real D(Real x) const =0

Member Function Documentation

◆ D()

template<typename Real>
virtual Real Utils::AlgoHNewton_base_fun< Real >::D ( Real x) const
pure virtual

Evaluate the function \( f'(x) \)

Parameters
[in]xthe point to evaluate \( f(x) \)
Returns
the value of \( f'(x) \)

◆ eval()

template<typename Real>
virtual Real Utils::AlgoHNewton_base_fun< Real >::eval ( Real x) const
pure virtual

Evaluate the function \( f(x) \)

Parameters
[in]xthe point to evaluate \( f(x) \)
Returns
the value of \( f(x) \)

The documentation for this class was generated from the following file: