Acoustic FDTD Solver
Public Member Functions | List of all members
Function Class Reference

#include <Function.hpp>

Inheritance diagram for Function:
Gaussian GaussianModulatedSinusoid Scalar Sinusoid

Public Member Functions

 Function ()
virtual double getValue (const double x) const
 Evaluate the function at x.
virtual void setScale (const double x)
virtual double getDf (const double x) const
 Evaluate the first-order derivative at x.
virtual double getFrequency () const
 return the central frequency
double rtnewt (const double x1, const double x2, const double xacc) const
 Use the Newton-Raphson method, find the root of a function known to line in the interval [x1, x2].
double rtsecan (double xn_1, double xn, const double xacc) const
 o * Use the secant method to find the root of a function with the initial guess at xn_1 and xn.
virtual ~Function ()

Constructor & Destructor Documentation

Function::Function ( )
virtual Function::~Function ( )
inlinevirtual

Member Function Documentation

double Function::getDf ( const double  x) const
virtual

Evaluate the first-order derivative at x.

Reimplemented in GaussianModulatedSinusoid, Sinusoid, Gaussian, and Scalar.

double Function::getFrequency ( ) const
virtual

return the central frequency

Reimplemented in GaussianModulatedSinusoid, Sinusoid, Gaussian, and Scalar.

double Function::getValue ( const double  x) const
virtual

Evaluate the function at x.

Reimplemented in GaussianModulatedSinusoid, Sinusoid, Gaussian, and Scalar.

double Function::rtnewt ( const double  x1,
const double  x2,
const double  xacc 
) const

Use the Newton-Raphson method, find the root of a function known to line in the interval [x1, x2].

The root rtnewt will be refined until its accuracy in known within +/-xacc. The maximum number of iteration is 1e5. See Numerical Recipes [Pre02] for the algorithm.

Parameters
x1lower bound
x2upper bound
xacctolerance on the derivative at current x
double Function::rtsecan ( double  xn_1,
double  xn,
const double  xacc 
) const

o * Use the secant method to find the root of a function with the initial guess at xn_1 and xn.

The method stop if it exceeds the maximum number of iteration IMAX = 100 or if |xn-xn_1| < xacc.

Parameters
xn_1initial guess at n-1
xninitial guess at n
xaccdistance between xn_1 and xn
void Function::setScale ( const double  x)
virtual

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