RhinoMathIntegrate Method (FuncObject, Int32, Double, Double, Object, Interval, Double, Double, Double) |
Calculates the definite integral of a smooth (C-infinity)
function using a Rhomberg integration technique.
Namespace:
Rhino
Assembly:
RhinoCommon (in RhinoCommon.dll)
Syntaxpublic static double Integrate(
Func<Object, int, double, double> integrandFunction,
Object context,
Interval limits,
double relativeTolerance,
double absoluteTolerance,
out double errorBound
)
Public Shared Function Integrate (
integrandFunction As Func(Of Object, Integer, Double, Double),
context As Object,
limits As Interval,
relativeTolerance As Double,
absoluteTolerance As Double,
<OutAttribute> ByRef errorBound As Double
) As Double
Parameters
- integrandFunction
- Type: SystemFuncObject, Int32, Double, Double
The integrand function is
double f(object context, int limit_direction, double t)
and returns the value of the integrand at t.
The limit_direction parameter will be -1, 0, or +1 and specifies
which limit direction should be used in the evaluation.
If limit_direction = 1, then the integrand may not be C-infinity at t and
should be evaluated using the limit from above.
If limit_direction = -1, then the integrand may not be C-infinity at t and
should be evaluated using the limit from below.
If limit_direction = 0, then the integrand is C-infinity at t and may
and evaluation from above and below will return the same answer.
- context
- Type: SystemObject
Anything you want to be passed to and used by the integrandFunction
- limits
- Type: Rhino.GeometryInterval
Limits of integration. The integrand must be C-infinity on each
interval (limits[0],limits[1]).
- relativeTolerance
- Type: SystemDouble
Desired relative tolerance.
If I = mathematical value and N = numerical integration value,
then the algorithm will terminate when
|I - N| <= relative_tolerance*|I|.
For example, if you want to know the answer with 5 digits of accuracy,
then pass 1e-5.
- absoluteTolerance
- Type: SystemDouble
Desired absolute tolerance.
If I = mathematical value and N = numerical integration value,
then the algorithm will terminate when
|I - N| <= absolute_tolerance.
- errorBound
- Type: SystemDouble
upper bound on the error in the calculation
Return Value
Type:
Double
If the calulation succeeds, then the numerical integral is returned.
Otherwise double.NaN is returned.
See Also