XLPack 7.0
XLPack Numerical Library (Excel Worksheet Functions) Reference Manual
Loading...
Searching...
No Matches

◆ WAvint()

Function WAvint ( A As  Double,
B As  Double,
N As  Long,
X As  Variant,
Y As  Variant 
)

Finite interval quadrature for a function with tabulated data (approximation with overlapping parabolas)

Purpose
WAvint integrates a function tabulated at arbitrarily spaced abscissas. The limits of integration need not coincide with the tabulated abscissas.
A method of overlapping parabolas fitted to the data is used provided that thereare at least 3 abscissas between the limits of integration.
WAvint also handles two special cases. If the limits of integration are equal, WAvint returns a result of zero regardless of the number of tabulated values. If there are only two function values, WAvint uses the trapezoid rule.
Returns
Computed approximate value of integral.
Parameters
[in]ALower limit of integration. (A <= B)
[in]BUpper limit of integration. (A <= B)
[in]NNumber of data. (N >= 2)
[in]X(N) Abscissas. (Must be in increasing order)
[in]Y(N) Ordinates (function values).
Reference
SLATEC
Example
Using the following table, compute S = integral of 1/(1 + x^2) dx [0, 4] (= atan(4)).
x 1/(1 + x^2)
----- -------------
-1 0.5
0 1
1 0.5
2 0.2
3 0.1
4 0.05882
5 0.03846
----- -------------

WAvint