XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ avint()

void avint ( int  n,
double  x[],
double  y[],
double  a,
double  b,
double *  result,
int *  info 
)

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

Purpose
This routine 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 there are at least 3 abscissas between the limits of integration.
avint also handles two special cases.
  • If the limits of integration are equal, avint returns a result of zero regardless of the number of tabulated values.
  • If there are only two function values, avint uses the trapezoid rule.
Parameters
[in]nNumber of data. (n >= 2)
[in]x[]Array x[lx] (lx >= n)
Abscissas (strictly in increasing order).
[in]y[]Array y[ly] (ly >= n)
Ordinates (function values).
[in]aLower limit of integration. (a <= b)
[in]bUpper limit of integration. (a <= b)
[out]resultComputed approximate value of integral.
[out]info= 0: Successful exit
= -1: The argument n had an illegal value (n < 2)
= -4: The argument a (or b) had an illegal value (a > b)
= 1: Less than 3 function values between the limits of integration
= 2: Abscissas not strictly in increasing order
Reference
SLATEC