Click or drag to resize

RhinoMathIntegrate Method (FuncObject, Int32, Double, Double, Object, Interval, Double, Double, CancellationToken, Double)

Calculates the definite integral of a smooth (C-infinity) function using a Rhomberg integration technique. The calculation can be canceled through the cancellation token.

Namespace:  Rhino
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 9.0
Syntax
public static double Integrate(
	Func<Object, int, double, double> integrandFunction,
	Object context,
	Interval limits,
	double relativeTolerance,
	double absoluteTolerance,
	CancellationToken cancellationToken,
	out double errorBound
)

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.
cancellationToken
Type: System.ThreadingCancellationToken
Token used to cancel the calculation. Cancellation is cooperative: it is checked each time the integrand is evaluated, and a canceled calculation returns double.NaN.
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