MtxIntDiff.MonteCarlo Method

Double MonteCarlo(TRealFunction Fun, Double lb, Double ub, TMtxFloatPrecision FloatPrecision, TVec Constants, Object[] ObjConst, Int32 N)

Numerical integration by Monte Carlo method.

#NameDescription
1FunIntegrating function.
2ConstantsAdditional constants defining Fun function, usually nil/null.
3ObjConstAdditional objects defining Fun function, usually nil/null.
4lbDefines lower bound.
5ubDefines pper bound.
6NNumber of random points in [lb,ub] interval (see comments above).
7FloatPrecisionDefines the computational precision to be used by the routine.

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

Remarks:

Performs a numerical integration of function of single variable by using Monte Carlo method.

Examples
private double IntFun(TVec x, TVec c, params object[] o)
{
    double x = x[0];
    return System.Math.Sin(x);
}
private void Example()
{
    TIntStopReason sr;
    double area = MtxIntDif.MonteCarlo(IntFun,0.0,System.Math.PI,null,null,65536);
}
See Also: MtxIntDiff.QuadGauss