IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Represents a real function of a real variabe. More...
Public Member Functions | |
RealFunction (DlgFunctionValue valueDelegate) | |
Constructs a new function where delegates are provided for calculation of function valu. More... | |
RealFunction (DlgFunctionValue valueDelegate, DlgFunctionValue derivativeDelegate) | |
Constructs a new function where delegates are provided for calculation of function valu and first derivative. More... | |
RealFunction (DlgFunctionValue valueDelegate, DlgFunctionValue derivativeDelegate, DlgFunctionValue secondDerivativeDelegate) | |
RealFunction (DlgFunctionValue valueDelegate, DlgFunctionValue derivativeDelegate, DlgFunctionValue secondDerivativeDelegate, DlgFunctionValue integralDelegate) | |
Constructs a new function where delegates are provided for calculation of function value, derivatives and integral. More... | |
RealFunction (DlgFunctionValue valueDelegate, DlgFunctionValue derivativeDelegate, DlgFunctionValue secondDerivativeDelegate, DlgFunctionValue integralDelegate, DlgFunctionValue inverseDelegate) | |
Constructs a new function where delegates are provided for calculation of function value, derivatives, integral and inverse. More... | |
RealFunction (DlgFunctionValue valueDelegate, DlgFunctionValue derivativeDelegate, DlgFunctionValue secondDerivativeDelegate, DlgFunctionHigherDerivative higherDerivativeDelegate, DlgFunctionValue integralDelegate, DlgFunctionValue inverseDelegate) | |
Constructs a new function where delegates are provided for calculation of function value, derivatives, integral and inverse. More... | |
RealFunction | CloneFunction () |
object | Clone () |
double | TransformedArgument (double t) |
double | InverseTransformedArgument (double x) |
virtual void | SetTransformationParameters (double kx, double sx, double ky, double sy) |
Sets parameters of the affine transformation parameters for both co-ordinates. More... | |
virtual void | SetXTransformationParameters (double kx, double sx) |
Sets parameters of the affine transformation parameters for independent variable. More... | |
override double | Value (double x) |
Returns the value of this function at the specified parameter. More... | |
override double | Derivative (double x) |
Returns the first derivative of this function at the specified parameter. More... | |
override double | Derivative (double x, int order) |
Returns the derivative of the given order of this function at the specified parameter. More... | |
override bool | HigherDerivativeDefined (int order) |
Tells whether the derivative of the given order is defined for this function (by implementation, not mathematically). Returns true if either the internal variable indicates true or the appropriate delegate is non-null. More... | |
override double | SecondDerivative (double x) |
Returns the second derivative of the given order of this function at the specified arameter. More... | |
override double | Integral (double x) |
Returns definite integral of the current function from 0 to the function argument. More... | |
override double | Inverse (double y) |
Returns value of the inverse of the current function at the specified value of dependent variable. More... | |
Public Member Functions inherited from IG.Num.RealFunctionBase | |
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. More... | |
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. More... | |
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. More... | |
virtual double | NumericalIntegral (double from, double to, int numintervals) |
Calculates numerical integral of this function. Simpson's formula is used. More... | |
virtual double | NumericalDerivative (double x, double stepsize) |
Calculates numerical derivative of this function. Central difference formula is used. More... | |
virtual double | NumericalSecondDerivative (double x, double stepsize) |
Calculates numerical second order derivative of this function. Central difference formula is used. More... | |
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. More... | |
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. More... | |
override string | ToString () |
Static Public Member Functions | |
static void | TestSpeed () |
Compares calculation times of three ways of evaluations of exponential function: directly by Math.Exp(), through a delegate initialized by this function, and through a Function object initialized by this function. The number of repetitions is pre-defined. More... | |
static void | TestSpeed (long numiterations) |
Compares calculation times of three ways of evaluations of exponential function: directly by Math.Exp(), through a delegate initialized by this function, and through a Function object initialized by this function. More... | |
Static Public Member Functions inherited from IG.Num.RealFunctionBase | |
static void | ExampleTests () |
Protected Member Functions | |
RealFunction () | |
virtual double | RefValue (double x) |
Returns the value of reference (untransformed) function. More... | |
virtual double | RefDerivative (double x) |
Returns the first derivative of reference (untransformed) function. More... | |
virtual double | RefDerivative (double x, int order) |
Returns the derivative of the given order of reference (untransformed) function. More... | |
virtual double | RefSecondDerivative (double x) |
Returns the second derivative of the given order of reference (untransformed) function. More... | |
virtual double | RefIntegral (double x) |
Returns definite integral of reference (untransformed) function from 0 to the function argument. More... | |
virtual double | RefInverse (double y) |
Returns inverse of the reference (untransformed) function. More... | |
Protected Attributes | |
bool | _valueDefined = false |
bool | _derivativeDefined = false |
int | _highestDerivativeDefined = 0 |
bool | _secondDerivativeDefined = false |
bool | _integralDefined = false |
bool | _inverseDefined = false |
Protected Attributes inherited from IG.Num.RealFunctionBase | |
string | _name |
string | _description |
Properties | |
override RealFunctionBase | DerivativeFunction [get] |
Returns a function that represents a derivative of the current function. More... | |
override RealFunctionBase | InverseFunction [get] |
Returns a function that represents inverse of the current function. More... | |
override RealFunctionBase | IntegralFunction [get] |
Returns a function that represents definite integral of the current function from 0 to function argument. More... | |
bool | DoTransform [get, private set] |
Whether or not transformation (stretch/shift) is applied to the reference function, either in x or to y. Setter sets value both for transformation in X and Y direction. More... | |
bool | TransformX [get, private set] |
Whether or not reference function is stretched/shifted in x direction. More... | |
bool | TransformY [get, private set] |
Whether or not reference function is stretched/shifted in x direction. More... | |
double | ScaleX [get, set] |
Gets or sets the scaling factor for independent variable. More... | |
double | ShiftX [get, set] |
Gets or sets the shift of independent variable. More... | |
double | ScaleY [get, set] |
Gets or sets the scaling factor for function value. More... | |
double | ShiftY [get, set] |
Gets or sets the shift for function value. More... | |
override bool | ValueDefined [get, set] |
Tells whether value of the function is defined by implementation. Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false). More... | |
override bool | DerivativeDefined [get, set] |
Tells whether the first derivative is defined for this function (by implementation, not mathematically). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false). More... | |
override bool | SecondDerivativeDefined [get, set] |
Tells whether the second derivative is defined for this function (by implementation, not mathematically). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false). More... | |
override bool | IntegralDefined [get, set] |
Indicates whether integral is defined for this function (w.r. implementation). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false). More... | |
override bool | InverseDefined [get, set] |
Indicates whether inverse is defined for this function (w.r. implementation). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false). More... | |
Properties inherited from IG.Num.RealFunctionBase | |
virtual string | Name [get, set] |
Returns a short name of thecurrent function. More... | |
virtual string | Description [get, set] |
Returns a short description of the current function. More... | |
virtual RealFunctionBase | DerivativeFunction [get] |
Returns a function object that represents a derivative of this function. Returns null if this is not implemented. More... | |
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. More... | |
virtual RealFunctionBase | InverseFunction [get] |
Returns a function object that represents an inverse function of this function. Returns null if not implemented. More... | |
abstract bool | ValueDefined [get, set] |
Tells whether value of the function is defined by implementation. More... | |
abstract bool | DerivativeDefined [get, set] |
Tells whether the first derivative is defined for this function (by implementation, not mathematically) More... | |
abstract bool | SecondDerivativeDefined [get, set] |
Tells whether the second derivative is defined for this function (by implementation, not mathematically) More... | |
abstract bool | IntegralDefined [get, set] |
Tells whether analytical itegral of the function is defined or not. More... | |
abstract bool | InverseDefined [get, set] |
Tells whether analytical inverse function is defined or not. More... | |
Properties inherited from IG.Num.IRealFunction | |
string | Name [get] |
Returns a short name of the function. More... | |
string | Description [get] |
Returns a short description of the function. More... | |
bool | ValueDefined [get] |
Tells whether value of the function is defined by implementation. More... | |
bool | DerivativeDefined [get] |
Tells whether the first derivative is defined for this function (by implementation, not mathematically) More... | |
bool | SecondDerivativeDefined [get] |
Tells whether the second derivative is defined for this function (by implementation, not mathematically) More... | |
bool | IntegralDefined [get] |
Tells whether analytical itegral of the function is defined or not. More... | |
bool | InverseDefined [get] |
Tells whether analytical inverse function is defined or not. More... | |
Private Member Functions | |
void | UpdateInternalData () |
Updates internal data dependencies. This function must be called whenever data on which other data is dependent changes. More... | |
Private Attributes | |
RealFunction | funcDerivative = null |
RealFunction | funcIntegral = null |
RealFunction | funcInverse = null |
DlgFunctionTransformation | InverseFunctionDlg = null |
DlgFunctionTransformation | IntegralFunctionDlg = null |
bool | _transfX = false |
bool | _transfY = false |
double | _scaleX = 1.0 |
double | _shiftX = 0.0 |
double | _scaleY = 1.0 |
double | _shiftY = 0.0 |
Represents a real function of a real variabe.
$A Igor xx;
|
inlineprotected |
|
inline |
Constructs a new function where delegates are provided for calculation of function valu.
valueDelegate | Delegate that calculates funciton value. If null then the function does not have value defined. |
|
inline |
Constructs a new function where delegates are provided for calculation of function valu and first derivative.
valueDelegate | Delegate that calculates funciton value. If null then the function does not have value defined. |
derivativeDelegate | Delegate that calculates function derivative. If null then the function does not have derivative defined. |
|
inline |
|
inline |
Constructs a new function where delegates are provided for calculation of function value, derivatives and integral.
valueDelegate | Delegate that calculates funciton value. If null then the function does not have value defined. |
derivativeDelegate | Delegate that calculates function derivative. If null then the function does not have derivative defined. |
secondDerivativeDelegate | Delegate that calculates function second derivative. If null then the function does not have second derivative defined. |
integralDelegate | Delegate that calculates funciton integral. If null then the function does not have integral defined. |
|
inline |
Constructs a new function where delegates are provided for calculation of function value, derivatives, integral and inverse.
valueDelegate | Delegate that calculates funciton value. If null then the function does not have value defined. |
derivativeDelegate | Delegate that calculates function derivative. If null then the function does not have derivative defined. |
secondDerivativeDelegate | Delegate that calculates function second derivative. If null then the function does not have second derivative defined. |
integralDelegate | Delegate that calculates funciton integral. If null then the function does not have integral defined. |
inverseDelegate | Delegate that calculates funciton inverse. If null then the function does not have inverse defined. |
|
inline |
Constructs a new function where delegates are provided for calculation of function value, derivatives, integral and inverse.
valueDelegate | Delegate that calculates funciton value. If null then the function does not have value defined. |
derivativeDelegate | Delegate that calculates function derivative. If null then the function does not have derivative defined. |
secondDerivativeDelegate | Delegate that calculates function second derivative. If null then the function does not have second derivative defined. |
higherDerivativeDelegate | Delegate that calculates function higher derivatives. If null then the function does not have higher derivatives defined. |
integralDelegate | Delegate that calculates funciton integral. If null then the function does not have integral defined. |
inverseDelegate | Delegate that calculates funciton inverse. If null then the function does not have inverse defined. |
|
inline |
|
inline |
|
inlineprivate |
Updates internal data dependencies. This function must be called whenever data on which other data is dependent changes.
|
inline |
|
inline |
|
inlinevirtual |
Sets parameters of the affine transformation parameters for both co-ordinates.
kx | Scaling factor for independent variable. |
sx | Shift for independent variable. |
ky | Scaling factor for function value. |
sy | Shift for function value. |
|
inlinevirtual |
Sets parameters of the affine transformation parameters for independent variable.
kx | Scaling factor for independent variable. |
sx | Shift for independent variable. |
|
inlineprotectedvirtual |
Returns the value of reference (untransformed) function.
Reimplemented in IG.Num.Func.Cubic, IG.Num.Func.WeightPol7, IG.Num.Func.WeightPol5, IG.Num.Func.WeightPol4, IG.Num.Func.Quadratic, IG.Num.Func.Constant, IG.Num.Func.WeightPol3, IG.Num.Func.Identity, IG.Num.Func.WeightReciprocalPower, IG.Num.Func.ReciprocalPower, IG.Num.Func.PenaltyPower, IG.Num.Func.Linear, IG.Num.Func.WeightGauss, IG.Num.Func.Exp, and IG.Script.ScritpRealFunctionExample.Container.Function.
|
inlineprotectedvirtual |
Returns the first derivative of reference (untransformed) function.
Reimplemented in IG.Num.Func.Cubic, IG.Num.Func.WeightPol7, IG.Num.Func.WeightPol5, IG.Num.Func.WeightPol4, IG.Num.Func.Quadratic, IG.Num.Func.Constant, IG.Num.Func.WeightPol3, IG.Num.Func.Identity, IG.Num.Func.WeightReciprocalPower, IG.Num.Func.PenaltyPower, IG.Num.Func.ReciprocalPower, IG.Num.Func.Linear, IG.Num.Func.WeightGauss, IG.Num.Func.Exp, and IG.Script.ScritpRealFunctionExample.Container.Function.
|
inlineprotectedvirtual |
Returns the derivative of the given order of reference (untransformed) function.
Reimplemented in IG.Num.Func.Cubic, IG.Num.Func.WeightPol7, IG.Num.Func.WeightPol5, IG.Num.Func.WeightPol4, IG.Num.Func.Quadratic, IG.Num.Func.WeightPol3, IG.Num.Func.WeightReciprocalPower, IG.Num.Func.PenaltyPower, IG.Num.Func.Linear, and IG.Num.Func.WeightGauss.
|
inlineprotectedvirtual |
Returns the second derivative of the given order of reference (untransformed) function.
Reimplemented in IG.Num.Func.Cubic, IG.Num.Func.WeightPol7, IG.Num.Func.WeightPol5, IG.Num.Func.WeightPol4, IG.Num.Func.Quadratic, IG.Num.Func.Constant, IG.Num.Func.WeightPol3, IG.Num.Func.Identity, IG.Num.Func.WeightReciprocalPower, IG.Num.Func.PenaltyPower, IG.Num.Func.ReciprocalPower, IG.Num.Func.Linear, IG.Num.Func.WeightGauss, IG.Num.Func.Exp, and IG.Script.ScritpRealFunctionExample.Container.Function.
|
inlineprotectedvirtual |
Returns definite integral of reference (untransformed) function from 0 to the function argument.
Reimplemented in IG.Num.Func.Cubic, IG.Num.Func.WeightPol7, IG.Num.Func.WeightPol5, IG.Num.Func.WeightPol4, IG.Num.Func.Quadratic, IG.Num.Func.Constant, IG.Num.Func.WeightPol3, IG.Num.Func.Identity, IG.Num.Func.WeightReciprocalPower, IG.Num.Func.PenaltyPower, IG.Num.Func.ReciprocalPower, IG.Num.Func.Linear, IG.Num.Func.WeightGauss, and IG.Num.Func.Exp.
|
inlineprotectedvirtual |
Returns inverse of the reference (untransformed) function.
Reimplemented in IG.Num.Func.Cubic, IG.Num.Func.WeightPol7, IG.Num.Func.WeightPol5, IG.Num.Func.WeightPol4, IG.Num.Func.Quadratic, IG.Num.Func.Constant, IG.Num.Func.WeightPol3, IG.Num.Func.Identity, IG.Num.Func.WeightReciprocalPower, IG.Num.Func.PenaltyPower, IG.Num.Func.ReciprocalPower, IG.Num.Func.Linear, IG.Num.Func.WeightGauss, and IG.Num.Func.Exp.
|
inline |
Returns the value of this function at the specified parameter.
Implements IG.Num.IRealFunction.
Referenced by IG.Num.RealFunction.TestSpeed().
|
inline |
Returns the first derivative of this function at the specified parameter.
Implements IG.Num.IRealFunction.
|
inline |
Returns the derivative of the given order of this function at the specified parameter.
Implements IG.Num.IRealFunction.
|
inline |
Tells whether the derivative of the given order is defined for this function (by implementation, not mathematically). Returns true if either the internal variable indicates true or the appropriate delegate is non-null.
Implements IG.Num.IRealFunction.
|
inline |
Returns the second derivative of the given order of this function at the specified arameter.
Implements IG.Num.IRealFunction.
|
inline |
Returns definite integral of the current function from 0 to the function argument.
Implements IG.Num.IRealFunction.
|
inline |
Returns value of the inverse of the current function at the specified value of dependent variable.
Implements IG.Num.IRealFunction.
|
inlinestatic |
Compares calculation times of three ways of evaluations of exponential function: directly by Math.Exp(), through a delegate initialized by this function, and through a Function object initialized by this function. The number of repetitions is pre-defined.
|
inlinestatic |
Compares calculation times of three ways of evaluations of exponential function: directly by Math.Exp(), through a delegate initialized by this function, and through a Function object initialized by this function.
numiterations | Number of repeated evaluations of function. |
References IG.Lib.StopWatch1.CpuTime, IG.Num.DlgFunctionValue(), IG.Num.Func.GetExp(), IG.Lib.StopWatch1.Reset(), IG.Lib.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Lib.StopWatch1.ToString(), and IG.Num.RealFunction.Value().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
get |
Returns a function that represents a derivative of the current function.
|
get |
Returns a function that represents inverse of the current function.
|
get |
Returns a function that represents definite integral of the current function from 0 to function argument.
|
getprivate setprotected |
Whether or not transformation (stretch/shift) is applied to the reference function, either in x or to y. Setter sets value both for transformation in X and Y direction.
|
getprivate setprotected |
Whether or not reference function is stretched/shifted in x direction.
|
getprivate setprotected |
Whether or not reference function is stretched/shifted in x direction.
|
getset |
Gets or sets the scaling factor for independent variable.
|
getset |
Gets or sets the shift of independent variable.
|
getset |
Gets or sets the scaling factor for function value.
|
getset |
Gets or sets the shift for function value.
|
getset |
Tells whether value of the function is defined by implementation. Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false).
|
getset |
Tells whether the first derivative is defined for this function (by implementation, not mathematically). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false).
|
getset |
Tells whether the second derivative is defined for this function (by implementation, not mathematically). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false).
|
getset |
Indicates whether integral is defined for this function (w.r. implementation). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false).
|
getset |
Indicates whether inverse is defined for this function (w.r. implementation). Getter returns true if internal flag is set OR appropriate delegate is defined. Setter sets the internal flag (i.e. delegate must also be set to null if getter should return false).