MtxIntDiff.QuadGauss Method

Overload List

#SignatureDescription
1function 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.
2function QuadGauss(Fun: TRealFunction; lb: Double; ub: Double; const BasePoints: TVec; const Weights: TVec; Parts: Integer): Double;Numerical integration by using regular Gaussian quadrature scheme.
3function 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.
4function 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)).

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.

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4StopReasonTIntStopReason
5FloatPrecisionTMtxFloatPrecision
6QMethodTQuadMethod
7ToleranceDoublescalar
8MaxIterInteger

Returns: Double - the numerical approximate on integral of function Fun between limits lb and ub.

Remarks:

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.

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4BasePointsTVec
5WeightsTVec
6PartsInteger

Returns: Double - the numerical approximate on integral of function Fun between limits lb and ub.

Remarks:

Check the following link to learn more about this algorithm

Examples
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;
See Also: MtxIntDiff.Romberg, MtxIntDiff.WeightsGauss, MtxIntDiff.WeightsNewtonCotes, MtxIntDiff.WeightsChebyshevGauss

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.

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4ConstantsTVec
5ObjConstTObjectArray
6StopReasonTIntStopReason
7FloatPrecisionTMtxFloatPrecision
8QMethodTQuadMethod
9ToleranceDoublescalar
10MaxIterInteger

Returns: Double - the numerical approximate on integral of function Fun between limits lb and ub.

Remarks:

This version calculates base points and weights on the fly.

See Also: MtxIntDiff.Romberg

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)).

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4ConstantsTVec
5ObjConstTObjectArray
6BasePointsTVec
7WeightsTVec
8PartsInteger

Returns: Double

Examples
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;