MtxIntDiff.QuadGauss Method

Overload List

#SignatureDescription
1Double QuadGauss(TRealFunction Fun, Double lb, Double ub, ref TIntStopReason StopReason, TMtxFloatPrecision FloatPrecision, TQuadMethod QMethod, Double Tolerance, Int32 MaxIter)Integration by using Gauss quadrature algorithm with no additional parameters for Fun.
2Double QuadGauss(TRealFunction Fun, Double lb, Double ub, TVec BasePoints, TVec Weights, Int32 Parts)Numerical integration by using regular Gaussian quadrature scheme.
3Double QuadGauss(TRealFunction Fun, Double lb, Double ub, TVec Constants, Object[] ObjConst, ref TIntStopReason StopReason, TMtxFloatPrecision FloatPrecision, TQuadMethod QMethod, Double Tolerance, Int32 MaxIter)Evaluate the numerical integral between lower and upper bound using Gauss quadrature algorithm.
4Double QuadGauss(TRealFunction Fun, Double lb, Double ub, TVec Constants, Object[] ObjConst, TVec BasePoints, TVec Weights, Int32 Parts)Numerical integration by using regular Gaussian quadrature scheme (Fun defined only with double(s)).

Overload 1: Double QuadGauss(TRealFunction Fun, Double lb, Double ub, ref TIntStopReason StopReason, TMtxFloatPrecision FloatPrecision, TQuadMethod QMethod, Double Tolerance, Int32 MaxIter)

Integration by using Gauss quadrature algorithm with no additional parameters for Fun.

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4StopReasonTIntStopReason (ref)
5FloatPrecisionTMtxFloatPrecision
6QMethodTQuadMethod
7ToleranceDoublescalar
8MaxIterInt32

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

Examples
private double IntFun(TVec x, TVec c, params object[] o)
{
    double x = x[0];
    return System.Math.Sin(x)*System.Math.Exp(-x*x);
}
private void Example()
{
    TIntStopReason sr;
    double area = MtxIntDif.QuadGauss(IntFun,-0.5*System.Math.PI, System.Math.PI, out sr, 1.0e-4, 8);
}

Overload 2: Double QuadGauss(TRealFunction Fun, Double lb, Double ub, TVec BasePoints, TVec Weights, Int32 Parts)

Numerical integration by using regular Gaussian quadrature scheme.

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4BasePointsTVecsource TVec
5WeightsTVecsource TVec
6PartsInt32

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
private double IntFun(TVec x, TVec c, params object[] o)
{
    double x = x[0];
    return System.Math.Sin(x)*System.Math.Exp(-x*x);
}
private void Example()
{
    Vector bpoints = new Vector(0);
    Vector weights = new Vector(0);
    MtxIntDiff.WeightsGauss(10,bpoints,weights);
    double area = MtxIntDif.QuadGauss(IntFun,-0.5*System.Math.PI,System.Math.PI,bpoints,weights,64);
}
See Also: MtxIntDiff.Romberg, MtxIntDiff.WeightsGauss, MtxIntDiff.WeightsNewtonCotes, MtxIntDiff.WeightsChebyshevGauss

Overload 3: Double QuadGauss(TRealFunction Fun, Double lb, Double ub, TVec Constants, Object[] ObjConst, ref TIntStopReason StopReason, TMtxFloatPrecision FloatPrecision, TQuadMethod QMethod, Double Tolerance, Int32 MaxIter)

Evaluate the numerical integral between lower and upper bound using Gauss quadrature algorithm.

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4ConstantsTVecsource TVec
5ObjConstObject[]
6StopReasonTIntStopReason (ref)
7FloatPrecisionTMtxFloatPrecision
8QMethodTQuadMethod
9ToleranceDoublescalar
10MaxIterInt32

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: Double QuadGauss(TRealFunction Fun, Double lb, Double ub, TVec Constants, Object[] ObjConst, TVec BasePoints, TVec Weights, Int32 Parts)

Numerical integration by using regular Gaussian quadrature scheme (Fun defined only with double(s)).

#NameTypeDescription
1FunTRealFunction
2lbDoublescalar
3ubDoublescalar
4ConstantsTVecsource TVec
5ObjConstObject[]
6BasePointsTVecsource TVec
7WeightsTVecsource TVec
8PartsInt32

Returns: Double