Double Romberg(TRealFunction Fun, Double lb, Double ub, TMtxFloatPrecision FloatPrecision, TVec Constants, Object[] ObjConst, ref TIntStopReason StopReason, Double Tolerance, Int32 MaxIter)
Numerical integration by using recursive Romberg algorithm.
| # | Name | Description |
|---|---|---|
| 1 | Fun | Integrating function. |
| 2 | Constants | Additional constants defining Fun function, usually nil/null. |
| 3 | ObjConst | Additional objects defining Fun function, usually nil/null. |
| 4 | lb | Defines lower bound. |
| 5 | ub | Defines upper bound. |
| 6 | StopReason | Returns algorithm stop reason. |
| 7 | Tolerance | Defines integration tolerance. |
| 8 | MaxIter | Defines maximum number of alorithm iterations. |
| 9 | FloatPrecision | Defines the computational precision to be used by the routine. |
Returns: Double - the numerical approximate on integral of function Fun between limits lb and ub.
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.Romberg(IntFun,0.0,5*System.Math.PI,out sr, 1.0e-4, 100);
}
See Also: MtxIntDiff.QuadGauss