Paul Heidmann Fractal Example
1.0
|
This class implements Newton's method (the same one from your typical first year calculus class), to find zeros of complex valued functions (in the complex plain, obviously). More...
#include <newtonsMethod.hpp>
Public Types | |
typedef std::complex< floatType > | cmplxType |
This type is used to declare variables that hold complex numbers. More... | |
typedef std::function < cmplxType(const cmplxType &)> | funcType |
This type is used to declare variables that hold functions whose zeros are being found. More... | |
Public Member Functions | |
newtonsMethod ()=delete | |
newtonsMethod (const cmplxType &initialGuess, const funcType &f, const funcType &f_prime, const std::uint32_t maxIterations, const floatType &epsilon) | |
This is the constructor that must be used to create instances of this class. More... | |
~newtonsMethod () | |
The class destructor. More... | |
const cmplxType | findZero (std::uint32_t &numIters) const |
This method is called to find a zero of the given function, using the given initial guess. More... | |
Private Attributes | |
const cmplxType | m_initialGuess |
This attribute holds the caller supplied initial guess. More... | |
const funcType | m_f |
This attribute holds the function whose zero is to be found. More... | |
const funcType | m_fPrime |
This attribute holds the derivative of the function whose zero is to be found. More... | |
const std::uint32_t | m_maxIterations |
This attribute holds the maximum number of iterations allowed when searching for a zero. More... | |
const floatType | m_epsilon |
This attribute holds the required accuracy (that is, tolerance). More... | |
This class implements Newton's method (the same one from your typical first year calculus class), to find zeros of complex valued functions (in the complex plain, obviously).
floatType | The floating point type to be used in the underlying computations. |
Definition at line 38 of file newtonsMethod.hpp.
typedef std::complex<floatType> fractal::newtonsMethod< floatType >::cmplxType |
This type is used to declare variables that hold complex numbers.
Definition at line 44 of file newtonsMethod.hpp.
typedef std::function<cmplxType(const cmplxType&)> fractal::newtonsMethod< floatType >::funcType |
This type is used to declare variables that hold functions whose zeros are being found.
Definition at line 48 of file newtonsMethod.hpp.
|
delete |
|
inline |
This is the constructor that must be used to create instances of this class.
initialGuess | The complex number that is to serve as the initial guess of the zero to be found. |
f | The function whose zero is to be found. |
f_prime | The derivative of the function whose zero is to be found. |
maxIterations | The maximum number of iterations that may be used by this implementation to find a zero. |
epsilon | The required accuracy. The zero must be found within this tolerance. |
Definition at line 63 of file newtonsMethod.hpp.
|
inline |
The class destructor.
Definition at line 78 of file newtonsMethod.hpp.
|
inline |
This method is called to find a zero of the given function, using the given initial guess.
numIters | An output parameter. The number of iterations actually required to find the given zero. |
Definition at line 85 of file newtonsMethod.hpp.
References fractal::newtonsMethod< floatType >::m_epsilon, fractal::newtonsMethod< floatType >::m_f, fractal::newtonsMethod< floatType >::m_fPrime, fractal::newtonsMethod< floatType >::m_initialGuess, and fractal::newtonsMethod< floatType >::m_maxIterations.
|
private |
This attribute holds the required accuracy (that is, tolerance).
Definition at line 125 of file newtonsMethod.hpp.
Referenced by fractal::newtonsMethod< floatType >::findZero().
|
private |
This attribute holds the function whose zero is to be found.
Definition at line 114 of file newtonsMethod.hpp.
Referenced by fractal::newtonsMethod< floatType >::findZero().
|
private |
This attribute holds the derivative of the function whose zero is to be found.
Definition at line 118 of file newtonsMethod.hpp.
Referenced by fractal::newtonsMethod< floatType >::findZero().
|
private |
This attribute holds the caller supplied initial guess.
Definition at line 111 of file newtonsMethod.hpp.
Referenced by fractal::newtonsMethod< floatType >::findZero().
|
private |
This attribute holds the maximum number of iterations allowed when searching for a zero.
Definition at line 122 of file newtonsMethod.hpp.
Referenced by fractal::newtonsMethod< floatType >::findZero().