IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Base class for real functions of real variable. More...
Public Member Functions | |
abstract double | Value (double x) |
Returns the value of this function at the specified parameter. | |
abstract double | Derivative (double x) |
Returns the first derivative of this function at the specified parameter. | |
abstract double | Derivative (double x, int order) |
Returns the derivative of the given order of this function at the specified parameter. | |
abstract bool | HigherDerivativeDefined (int order) |
Tells whether the derivative of the given order is defined for this function (by implementation, not mathematically) | |
abstract double | SecondDerivative (double x) |
Returns the second derivative of the given order of this function at the specified arameter. | |
abstract double | Integral (double x) |
Returns integral from 0 to x of the function. Throws an exception if the integral is not defined. | |
abstract double | Inverse (double y) |
Returns Inverse of the current function applied to function argument. Throws an exception if the inverse function is not defined. | |
void | Tabulate (double from, double to, int numPoints) |
Tabulates the current function and its first and second derivatives (when available) on the specified interval, in the specified number of points. | |
void | Tabulate (double from, double to, int numPoints, bool printDerivatives) |
Tabulates the current function and its first and eventually second derivatives (when available) on the specified interval, in the specified number of points. | |
void | Tabulate (double from, double to, int numPoints, bool printDerivatives, bool printSecondDerivatives) |
Tabulates the current function and eventually its first and second derivatives (when available) on the specified interval, in the specified number of points. | |
virtual double | NumericalIntegral (double from, double to, int numintervals) |
Calculates numerical integral of this function. Simpson's formula is used. | |
virtual double | NumericalDerivative (double x, double stepsize) |
Calculates numerical derivative of this function. Central difference formula is used. | |
virtual double | NumericalSecondDerivative (double x, double stepsize) |
Calculates numerical second order derivative of this function. Central difference formula is used. | |
virtual void | Test () |
Performs numerical tests with parameters adjusted for specific function. This function can be be overridden in derived classes, however its current implementation may be relatively well suited for most weighting and basic functions. | |
virtual void | Test (double from, double to, int numProbes, double stepSize, double tolerance) |
Performs some numerical tests on the current function, such as correctness of first and second derivatives, integral and inverse of the function. Results are written to the standard output. Whenever a numerical result does not match the corresponding analytical value calculated by the function, a visible notification is written. | |
override string | ToString () |
Static Public Member Functions | |
static void | ExampleTests () |
Protected Attributes | |
string | _name |
string | _description |
Properties | |
virtual string | Name [get, set] |
Returns a short name of thecurrent function. | |
virtual string | Description [get, set] |
Returns a short description of the current function. | |
virtual RealFunctionBase | DerivativeFunction [get] |
Returns a function object that represents a derivative of this function. Returns null if this is not implemented. | |
virtual RealFunctionBase | IntegralFunction [get] |
Returns a function object that represents a definite integral of this function from 0 to 1. Returns null if not implemented. | |
virtual RealFunctionBase | InverseFunction [get] |
Returns a function object that represents an inverse function of this function. Returns null if not implemented. | |
abstract bool | ValueDefined [get, set] |
Tells whether value of the function is defined by implementation. | |
abstract bool | DerivativeDefined [get, set] |
Tells whether the first derivative is defined for this function (by implementation, not mathematically) | |
abstract bool | SecondDerivativeDefined [get, set] |
Tells whether the second derivative is defined for this function (by implementation, not mathematically) | |
abstract bool | IntegralDefined [get, set] |
Tells whether analytical itegral of the function is defined or not. | |
abstract bool | InverseDefined [get, set] |
Tells whether analytical inverse function is defined or not. |
Base class for real functions of real variable.
A number of predefined functions can be bound in the class Func.
$A Igor xx;
abstract double IG::Num::RealFunctionBase::Value | ( | double | x | ) | [pure virtual] |
Returns the value of this function at the specified parameter.
Implements IG::Num::IRealFunction.
Implemented in IG::Num::RealFunction, IG::Gr::PlotterZedGraph::ExampleSineFunctionForLissajous, IG::Gr3d::VtkPlotBase::ExampleSineFunctionForLissajous, and IG::Gr3d::VtkPlotBase::ExampleFunctionTorusKnot.
abstract double IG::Num::RealFunctionBase::Derivative | ( | double | x | ) | [pure virtual] |
Returns the first derivative of this function at the specified parameter.
Implements IG::Num::IRealFunction.
Implemented in IG::Num::RealFunction.
abstract double IG::Num::RealFunctionBase::Derivative | ( | double | x, |
int | order | ||
) | [pure virtual] |
Returns the derivative of the given order of this function at the specified parameter.
Implements IG::Num::IRealFunction.
Implemented in IG::Num::RealFunction, IG::Num::Func::Identity, and IG::Num::Func::Constant.
abstract bool IG::Num::RealFunctionBase::HigherDerivativeDefined | ( | int | order | ) | [pure virtual] |
Tells whether the derivative of the given order is defined for this function (by implementation, not mathematically)
Implements IG::Num::IRealFunction.
Implemented in IG::Lib::LoadableRealFunctionBase, IG::Num::RealFunction, IG::Num::FunctionPolynomial, IG::Num::Func::Exp, IG::Num::Func::ReciprocalPower, IG::Num::Func::Identity, IG::Num::Func::Constant, IG::Num::Func::Linear, IG::Num::Func::Quadratic, IG::Num::Func::Cubic, IG::Num::Func::PenaltyPower, IG::Num::Func::WeightGauss, IG::Num::Func::WeightReciprocalPower, IG::Num::Func::WeightPol3, IG::Num::Func::WeightPol4, IG::Num::Func::WeightPol5, and IG::Num::Func::WeightPol7.
abstract double IG::Num::RealFunctionBase::SecondDerivative | ( | double | x | ) | [pure virtual] |
Returns the second derivative of the given order of this function at the specified arameter.
Implements IG::Num::IRealFunction.
Implemented in IG::Num::RealFunction.
abstract double IG::Num::RealFunctionBase::Integral | ( | double | x | ) | [pure virtual] |
Returns integral from 0 to x of the function. Throws an exception if the integral is not defined.
x | Upper bound of the integral. |
Implements IG::Num::IRealFunction.
Implemented in IG::Num::RealFunction.
abstract double IG::Num::RealFunctionBase::Inverse | ( | double | y | ) | [pure virtual] |
Returns Inverse of the current function applied to function argument. Throws an exception if the inverse function is not defined.
Implements IG::Num::IRealFunction.
Implemented in IG::Num::RealFunction.
void IG::Num::RealFunctionBase::Tabulate | ( | double | from, |
double | to, | ||
int | numPoints | ||
) | [inline] |
Tabulates the current function and its first and second derivatives (when available) on the specified interval, in the specified number of points.
from | Left interval bound. |
to | Right interval bound. |
numPoints | Number of points in which the function is calculated. |
Implements IG::Num::IRealFunction.
void IG::Num::RealFunctionBase::Tabulate | ( | double | from, |
double | to, | ||
int | numPoints, | ||
bool | printDerivatives | ||
) | [inline] |
Tabulates the current function and its first and eventually second derivatives (when available) on the specified interval, in the specified number of points.
from | Left interval bound. |
to | Right interval bound. |
numPoints | Number of points in which the function is calculated. |
printSecondDerivatives | Whether to print the second derivatives. |
Implements IG::Num::IRealFunction.
void IG::Num::RealFunctionBase::Tabulate | ( | double | from, |
double | to, | ||
int | numPoints, | ||
bool | printDerivatives, | ||
bool | printSecondDerivatives | ||
) | [inline] |
Tabulates the current function and eventually its first and second derivatives (when available) on the specified interval, in the specified number of points.
from | Left interval bound. |
to | Right interval bound. |
numPoints | Number of points in which the function is calculated. |
printDerivatives | Whether to print the derivatives. |
printSecondDerivatives | Whether to print the second derivatives. |
Implements IG::Num::IRealFunction.
virtual double IG::Num::RealFunctionBase::NumericalIntegral | ( | double | from, |
double | to, | ||
int | numintervals | ||
) | [inline, virtual] |
Calculates numerical integral of this function. Simpson's formula is used.
from | Lower integral limit. |
to | Upper integral limit. |
numintervals | Number of subintervals (1 less thatn the number of evaluation points) |
Implements IG::Num::IRealFunction.
virtual double IG::Num::RealFunctionBase::NumericalDerivative | ( | double | x, |
double | stepsize | ||
) | [inline, virtual] |
Calculates numerical derivative of this function. Central difference formula is used.
x | Point at which derivative is calculated. |
stepsize | Step size. |
Implements IG::Num::IRealFunction.
virtual double IG::Num::RealFunctionBase::NumericalSecondDerivative | ( | double | x, |
double | stepsize | ||
) | [inline, virtual] |
Calculates numerical second order derivative of this function. Central difference formula is used.
x | Point at which second order derivative is calculated. |
stepsize | Step size. |
Implements IG::Num::IRealFunction.
virtual void IG::Num::RealFunctionBase::Test | ( | ) | [inline, virtual] |
Performs numerical tests with parameters adjusted for specific function. This function can be be overridden in derived classes, however its current implementation may be relatively well suited for most weighting and basic functions.
virtual void IG::Num::RealFunctionBase::Test | ( | double | from, |
double | to, | ||
int | numProbes, | ||
double | stepSize, | ||
double | tolerance | ||
) | [inline, virtual] |
Performs some numerical tests on the current function, such as correctness of first and second derivatives, integral and inverse of the function. Results are written to the standard output. Whenever a numerical result does not match the corresponding analytical value calculated by the function, a visible notification is written.
from | Lower bound of the interval where tests are performed. |
to | Upper bound of the interval where tests are performed. |
numSamples | Number of points for which evaluations and comparisons are performed. |
stepSize | Step size used for numerical integration and differentiation. |
tolerance | Absolute tolarence for match between analytical and numeriacl values (visible notification is launched whenever difference is larger than tolerance). |
static void IG::Num::RealFunctionBase::ExampleTests | ( | ) | [inline, static] |
override string IG::Num::RealFunctionBase::ToString | ( | ) | [inline] |
string IG::Num::RealFunctionBase::_name [protected] |
Reimplemented in IG::Num::RealFunction.
string IG::Num::RealFunctionBase::_description [protected] |
Reimplemented in IG::Num::RealFunction.
virtual string IG::Num::RealFunctionBase::Name [get, set] |
Returns a short name of thecurrent function.
Implements IG::Num::IRealFunction.
Reimplemented in IG::Lib::LoadableRealFunctionBase, and IG::Num::RealFunction.
virtual string IG::Num::RealFunctionBase::Description [get, set] |
Returns a short description of the current function.
Implements IG::Num::IRealFunction.
Reimplemented in IG::Lib::LoadableRealFunctionBase, and IG::Num::RealFunction.
virtual RealFunctionBase IG::Num::RealFunctionBase::DerivativeFunction [get] |
Returns a function object that represents a derivative of this function. Returns null if this is not implemented.
Reimplemented in IG::Num::RealFunction.
virtual RealFunctionBase IG::Num::RealFunctionBase::IntegralFunction [get] |
Returns a function object that represents a definite integral of this function from 0 to 1. Returns null if not implemented.
Reimplemented in IG::Num::RealFunction.
virtual RealFunctionBase IG::Num::RealFunctionBase::InverseFunction [get] |
Returns a function object that represents an inverse function of this function. Returns null if not implemented.
Reimplemented in IG::Num::RealFunction.
abstract bool IG::Num::RealFunctionBase::ValueDefined [get, set] |
Tells whether value of the function is defined by implementation.
Implements IG::Num::IRealFunction.
Reimplemented in IG::Lib::LoadableRealFunctionBase, IG::Num::RealFunction, IG::Num::FunctionPolynomial, IG::Num::Func::Exp, IG::Num::Func::ReciprocalPower, IG::Num::Func::Identity, IG::Num::Func::Constant, IG::Num::Func::Linear, IG::Num::Func::Quadratic, IG::Num::Func::Cubic, IG::Num::Func::PenaltyPower, IG::Num::Func::WeightGauss, IG::Num::Func::WeightReciprocalPower, IG::Num::Func::WeightPol3, IG::Num::Func::WeightPol4, IG::Num::Func::WeightPol5, and IG::Num::Func::WeightPol7.
abstract bool IG::Num::RealFunctionBase::DerivativeDefined [get, set] |
Tells whether the first derivative is defined for this function (by implementation, not mathematically)
Implements IG::Num::IRealFunction.
Reimplemented in IG::Lib::LoadableRealFunctionBase, IG::Num::RealFunction, IG::Num::FunctionPolynomial, IG::Num::Func::Exp, IG::Num::Func::ReciprocalPower, IG::Num::Func::Identity, IG::Num::Func::Constant, IG::Num::Func::Linear, IG::Num::Func::Quadratic, IG::Num::Func::Cubic, IG::Num::Func::PenaltyPower, IG::Num::Func::WeightGauss, IG::Num::Func::WeightReciprocalPower, IG::Num::Func::WeightPol3, IG::Num::Func::WeightPol4, IG::Num::Func::WeightPol5, and IG::Num::Func::WeightPol7.
abstract bool IG::Num::RealFunctionBase::SecondDerivativeDefined [get, set] |
Tells whether the second derivative is defined for this function (by implementation, not mathematically)
Implements IG::Num::IRealFunction.
Reimplemented in IG::Lib::LoadableRealFunctionBase, IG::Num::RealFunction, IG::Num::FunctionPolynomial, IG::Num::Func::Exp, IG::Num::Func::ReciprocalPower, IG::Num::Func::Identity, IG::Num::Func::Constant, IG::Num::Func::Linear, IG::Num::Func::Quadratic, IG::Num::Func::Cubic, IG::Num::Func::PenaltyPower, IG::Num::Func::WeightGauss, IG::Num::Func::WeightReciprocalPower, IG::Num::Func::WeightPol3, IG::Num::Func::WeightPol4, IG::Num::Func::WeightPol5, and IG::Num::Func::WeightPol7.
abstract bool IG::Num::RealFunctionBase::IntegralDefined [get, set] |
Tells whether analytical itegral of the function is defined or not.
Implements IG::Num::IRealFunction.
Reimplemented in IG::Lib::LoadableRealFunctionBase, IG::Num::RealFunction, IG::Num::FunctionPolynomial, IG::Num::Func::Exp, IG::Num::Func::ReciprocalPower, IG::Num::Func::Identity, IG::Num::Func::Constant, IG::Num::Func::Linear, IG::Num::Func::Quadratic, IG::Num::Func::Cubic, IG::Num::Func::PenaltyPower, IG::Num::Func::WeightGauss, IG::Num::Func::WeightReciprocalPower, IG::Num::Func::WeightPol3, IG::Num::Func::WeightPol4, IG::Num::Func::WeightPol5, and IG::Num::Func::WeightPol7.
abstract bool IG::Num::RealFunctionBase::InverseDefined [get, set] |
Tells whether analytical inverse function is defined or not.
Implements IG::Num::IRealFunction.
Reimplemented in IG::Lib::LoadableRealFunctionBase, IG::Num::RealFunction, IG::Num::FunctionPolynomial, IG::Num::Func::Exp, IG::Num::Func::ReciprocalPower, IG::Num::Func::Identity, IG::Num::Func::Constant, IG::Num::Func::Linear, IG::Num::Func::Quadratic, IG::Num::Func::Cubic, IG::Num::Func::PenaltyPower, IG::Num::Func::WeightGauss, IG::Num::Func::WeightReciprocalPower, IG::Num::Func::WeightPol3, IG::Num::Func::WeightPol4, IG::Num::Func::WeightPol5, and IG::Num::Func::WeightPol7.