RhinoMathIntegrate Method (FuncObject, Int32, Double, Double, Object, Curve, Double, Double, Double) |
Calculates the definite integral of a smooth (C-infinity)
function of one variable using a Rhomberg integration technique
and returns returns Integral(f(t)*|curve'(t)|*dt).
The C-infinity requirement is used by the Rhomberg algorithm when
estimating error bounds and convergence. If you choose to pass a
C2 function, you are likely to converge while getting less accurate
results and incorrect error bound estimates.
Using a C0 or C1 fucntion will often return nonsense.
Namespace:
Rhino
Assembly:
RhinoCommon (in RhinoCommon.dll)
Syntaxpublic static double Integrate(
Func<Object, int, double, double> integrandFunction,
Object context,
Curve curve,
double relativeTolerance,
double absoluteTolerance,
out double errorBound
)
Public Shared Function Integrate (
integrandFunction As Func(Of Object, Integer, Double, Double),
context As Object,
curve As Curve,
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(ON__UINT_PTR 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
First parameter passed into the integrand function.
- curve
- Type: Rhino.GeometryCurve
The integration is performed over the C-infinity spans of the curve
and |curve'(t)| is automatically included in the integrand.
The integrand must be C-infinity on the intesection each curve span
with the interval (limits[0],limits[1]).
The curve may have any dimension.
- 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
If error_bound is not nullptr, then the returned value is upper bound
on the error in the calculation.
If I = mathematical value and N = returned value,
then |I - N| <= *error_bound;
Return Value
Type:
Double
If the calulation succeeds, then the numerical integral is returned.
Otherwise ON_DBL_QNAN is returned.
See Also