isce3 0.25.0
Loading...
Searching...
No Matches
isce3::math::RootFind1dNewton Class Reference

A class with overloaded method to solve 1-D (single variable) equation f(x)=0 with at least one real-value root/solution via Newton approach See Newton method. More...

#include <RootFind1dNewton.h>

Inheritance diagram for isce3::math::RootFind1dNewton:
isce3::math::detail::RootFind1dBase

Public Member Functions

std::tuple< double, double, bool, int > root (const isce3::core::Poly1d &f, double x0=0) const
 Find a root of the function "f(x)" closest to its initial value via Newton approach.
 
std::tuple< double, double, bool, int > root (const std::function< double(double)> &f, const std::function< double(double)> &f_der, double x0=0) const
 Find a root of the function "f(x)" closest to its initial value via Newton approach.
 
std::tuple< double, double, bool, int > root (const std::function< std::tuple< double, double >(double)> &f, double x0=0) const
 Find a root of the function "f(x)" closest to its initial value via Newton approach.
 
- Public Member Functions inherited from isce3::math::detail::RootFind1dBase
 RootFind1dBase (double f_tol=1e-5, int max_iter=20, std::optional< double > x_tol={})
 A default constructor with absolute tolerances for "x" and "f(x)" plus max number of iterations.
 
 RootFind1dBase (int max_iter)
 A constructor with max number of iterations.
 
double func_tol () const
 Get the absolute tolerance for function value.
 
int max_num_iter () const
 Get max number of iteration being set.
 
std::optional< double > var_tol () const
 Get the absolute tolerance for function variable "x" if set It returns std::nullopt if "x_tol" is not specified at object creation.
 

Protected Types

using func_t = std::function<double(double)>
 
using tuple4_t = std::tuple<double, double, bool, int>
 
using poly1d_t = isce3::core::Poly1d
 
using func2_t = std::function<std::tuple<double, double>(double)>
 

Additional Inherited Members

- Static Public Member Functions inherited from isce3::math::detail::RootFind1dBase
static std::function< double(double)> poly2func (const isce3::core::Poly1d &f)
 Convert isce3 Poly1d object into a single-variavle function object "f(x)".
 
- Protected Attributes inherited from isce3::math::detail::RootFind1dBase
double f_tol
 
int max_iter
 
std::optional< double > x_tol
 

Detailed Description

A class with overloaded method to solve 1-D (single variable) equation f(x)=0 with at least one real-value root/solution via Newton approach See Newton method.

Member Function Documentation

◆ root() [1/3]

RootFind1dNewton::tuple4_t isce3::math::RootFind1dNewton::root ( const isce3::core::Poly1d & f,
double x0 = 0 ) const

Find a root of the function "f(x)" closest to its initial value via Newton approach.

Parameters
[in]fisce3.core.Poly1d object expressing 1-D function "f(x)" as polynomial.
[in]x0(optional) initial guess of the "x". Default is 0.0.
Returns
solution "x"
function eval "f(x)"
convergence flag (true or false)
number of iterations
Exceptions
InvalidArgument

◆ root() [2/3]

RootFind1dNewton::tuple4_t isce3::math::RootFind1dNewton::root ( const std::function< double(double)> & f,
const std::function< double(double)> & f_der,
double x0 = 0 ) const

Find a root of the function "f(x)" closest to its initial value via Newton approach.

Parameters
[in]fsingle-variable function object to represent "f(x)".
[in]f_dersingle-variable function object to represent derivative of "f(x)".
[in]x0(optional) initial guess of the "x". Default is 0.0.
Returns
solution "x"
function eval "f(x)"
convergence flag (true or false)
number of iterations

◆ root() [3/3]

RootFind1dNewton::tuple4_t isce3::math::RootFind1dNewton::root ( const std::function< std::tuple< double, double >(double)> & f,
double x0 = 0 ) const

Find a root of the function "f(x)" closest to its initial value via Newton approach.

Parameters
[in]fsingle-variable function object to return a tuple of "f(x)" and "f_der(x)", that is both function value and its first derivative for "x".
[in]x0(optional) initial guess of the "x". Default is 0.0.
Returns
solution "x"
function eval "f(x)"
convergence flag (true or false)
number of iterations

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

Generated for ISCE3.0 by doxygen 1.13.2.