Overload List
Overload 1: function QuadGauss(Fun: TRealFunction; lb: Double; ub: Double; out StopReason: TIntStopReason; const FloatPrecision: TMtxFloatPrecision; QMethod: TQuadMethod; Tolerance: Double; MaxIter: Integer): Double;
Integration by using Gauss quadrature algorithm with no additional parameters for Fun.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | lb | Double | scalar |
| 3 | ub | Double | scalar |
| 4 | StopReason | TIntStopReason | |
| 5 | FloatPrecision | TMtxFloatPrecision | |
| 6 | QMethod | TQuadMethod | |
| 7 | Tolerance | Double | scalar |
| 8 | MaxIter | Integer |
Returns: Double - the numerical approximate on integral of function Fun between limits lb and ub.
This version calculates base points and weights on the fly.
Note
Use this overload if integrating function is defined only by double parameter(s).
Overload 2: function QuadGauss(Fun: TRealFunction; lb: Double; ub: Double; const BasePoints: TVec; const Weights: TVec; Parts: Integer): Double;
Numerical integration by using regular Gaussian quadrature scheme.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | lb | Double | scalar |
| 3 | ub | Double | scalar |
| 4 | BasePoints | TVec | |
| 5 | Weights | TVec | |
| 6 | Parts | Integer |
Returns: Double - the numerical approximate on integral of function Fun between limits lb and ub.
Check the following link to learn more about this algorithm
Uses MtxExpr, Math387, MtxIntDiff;
// Integrating function
function IntFunc(const Parameters: TVec; const Constants: TVec; const ObjConst: Array of TObject): double;
var x: double;
begin
x := Parameters[0];
IntFunc := Sin(x)*Exp(-x*x);
end;
// Integrate
procedure DoIntegrate;
var bpoints,weights: Vector;
area: double;
begin
WeightsGauss(10,bpoints,weights);
area := QuadGauss(IntFunc,-0.5*PI,PI,bpoints,weights,64);
end;
Overload 3: function QuadGauss(Fun: TRealFunction; lb: Double; ub: Double; const Constants: TVec; const ObjConst: TObjectArray; out StopReason: TIntStopReason; const FloatPrecision: TMtxFloatPrecision; QMethod: TQuadMethod; Tolerance: Double; MaxIter: Integer): Double;
Evaluate the numerical integral between lower and upper bound using Gauss quadrature algorithm.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | lb | Double | scalar |
| 3 | ub | Double | scalar |
| 4 | Constants | TVec | |
| 5 | ObjConst | TObjectArray | |
| 6 | StopReason | TIntStopReason | |
| 7 | FloatPrecision | TMtxFloatPrecision | |
| 8 | QMethod | TQuadMethod | |
| 9 | Tolerance | Double | scalar |
| 10 | MaxIter | Integer |
Returns: Double - the numerical approximate on integral of function Fun between limits lb and ub.
This version calculates base points and weights on the fly.
Overload 4: function QuadGauss(Fun: TRealFunction; lb: Double; ub: Double; const Constants: TVec; const ObjConst: TObjectArray; const BasePoints: TVec; const Weights: TVec; Parts: Integer): Double;
Numerical integration by using regular Gaussian quadrature scheme (Fun defined only with double(s)).
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | lb | Double | scalar |
| 3 | ub | Double | scalar |
| 4 | Constants | TVec | |
| 5 | ObjConst | TObjectArray | |
| 6 | BasePoints | TVec | |
| 7 | Weights | TVec | |
| 8 | Parts | Integer |
Returns: Double
Uses Math387, MtxIntDiff;
// Integrating function
function IntFunc(const Parameters: TVec; const Constants: TVec; const ObjConst: Array of TObject): double;
var x: double;
begin
x := Parameters[0];
IntFunc:= Sin(x)*Exp(-x*x);
end;
// Integrate
procedure DoIntegrate;
var area: double;
sr: TIntStopReason;
begin
area := QuadGauss(IntFunc,-0.5*PI,PI,sr);
end;