NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::roots::Secant Class Reference

#include <Secant.hpp>

Inherits nc::roots::Iteration.

Public Member Functions

 Secant (const double epsilon, const uint32 maxNumIterations, std::function< double(double)> f) noexcept
 
 Secant (const double epsilon, std::function< double(double)> f) noexcept
 
 ~Secant () override=default
 
uint32 numIterations () const noexcept
 
double solve (double a, double b)
 

Protected Member Functions

void incrementNumberOfIterations ()
 
void resetNumberOfIterations () noexcept
 

Protected Attributes

const double epsilon_
 
uint32 maxNumIterations_ { 1000 }
 
uint32 numIterations_ { 0 }
 

Detailed Description

Secant root finding method

Constructor & Destructor Documentation

◆ Secant() [1/2]

nc::roots::Secant::Secant ( const double  epsilon,
std::function< double(double)>  f 
)
inlinenoexcept

Constructor

Parameters
epsilonthe epsilon value
fthe function

◆ Secant() [2/2]

nc::roots::Secant::Secant ( const double  epsilon,
const uint32  maxNumIterations,
std::function< double(double)>  f 
)
inlinenoexcept

Constructor

Parameters
epsilonthe epsilon value
maxNumIterationsthe maximum number of iterations to perform
fthe function

◆ ~Secant()

nc::roots::Secant::~Secant ( )
overridedefault

Destructor

Member Function Documentation

◆ incrementNumberOfIterations()

void nc::roots::Iteration::incrementNumberOfIterations ( )
inlineprotectedinherited

Incraments the number of iterations

◆ numIterations()

uint32 nc::roots::Iteration::numIterations ( ) const
inlinenoexceptinherited

Returns the number of iterations

Returns
: number of iterations

◆ resetNumberOfIterations()

void nc::roots::Iteration::resetNumberOfIterations ( )
inlineprotectednoexceptinherited

Resets the number of iterations

◆ solve()

double nc::roots::Secant::solve ( double  a,
double  b 
)
inline

Solves for the root in the range [a, b]

Parameters
athe lower bound
bthe upper bound
Returns
root between the bound

Field Documentation

◆ epsilon_

const double nc::roots::Iteration::epsilon_
protectedinherited

◆ maxNumIterations_

uint32 nc::roots::Iteration::maxNumIterations_ { 1000 }
protectedinherited

◆ numIterations_

uint32 nc::roots::Iteration::numIterations_ { 0 }
protectedinherited

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