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

◆ qagp()

void qagp ( double(*)(double)  f,
double  a,
double  b,
int  npts2,
double  points[],
double  epsabs,
double  epsrel,
int  limit,
double *  result,
double *  abserr,
int *  neval,
int *  last,
double  work[],
int  lwork,
int  iwork[],
int  liwork,
int *  info 
)

Finite interval adaptive quadrature with known singular points (21-point Gauss-Kronrod rule)

Purpose
The routine computes an approximation result to a definite integral I = integral of f(x) over [a, b], satisfying the requested accuracy. Break points of the integration interval, where local difficulties of the integrand may occur (e.g. singularities, discontinuities), can be provided by the user.
Result is obtained by the adaptive integration applying the 21-point Gauss-Kronrod rule to satisfy the requested accuracy.
Parameters
[in]fThe user supplied subroutine which calculates the integrand function f(x) defined as follows.
double f(double x)
{
return computed f(x) value
}
[in]aLower limit of integration.
[in]bUpper limit of integration.
[in]npts2(the number of user-supplied break points of the integration interval) + 2. (npts2 >= 2)
[in]points[]Array points[lpoints] (lpoints >= npts2)
The user provided break points are to be supplied in points[0] to points[npts2-3].
[in]epsabsAbsolute accuracy requested.
The requested accuracy is assumed to be satisfied if abserr <= max(epsabs, epsrel*|result|)).
[in]epsrelRelative accuracy requested.
The requested accuracy is assumed to be satisfied if abserr <= max(epsabs, epsrel*|result|)).
If epsabs <= 0 and epsrel < 50*eps, epsrel is assumed to be 50*eps, where eps is the machine precision.
[in]limitMaximum number of subintervals in the partition of the given integration interval [a, b]. (limit >= npts2 - 1)
[out]resultApproximation to I = integral of f(x) over [a, b].
[out]abserrEstimate of the modulus of the absolute error, which should equal or exceed the true error.
[out]nevalNumber of integrand evaluations.
[out]lastNumber of subintervals produced in the subdivision process.
[out]work[]Array work[lwork]
Work array.
work[0], ..., work[last-1]: Left end points of the subintervals in the partition of [a, b].
work[limit], ..., work[limit+last-1]: Right end poits of the subintervals.
work[2*limit], ..., work[2*limit+last-1]: The integral approximations over the subintervals.
work[3*limit], ..., work[3*limit+last-1]: The error estimates over the subintervals.
work[4*limit], ..., work[4*limit+npts2-1]: The integration limits and the break points sorted in an ascending sequence.
[in]lworkThe length of work[]. (lwork >= 4*limit + npts2)
[out]iwork[]Array iwork[liwork]
Work array.
The first k elements contain pointers to the error estimates over the subintervals, such that work[3*limit+iwork[0]-1], ..., work[3*limit+iwork[k-1]-1] form a decreasing sequence with k = last if last <= limit/2+2, and k = limit+1-last otherwise.
iwork[limit], ..., iwork[limit+last-1] contain the subdivision levels of the subintervals, i.e. if [aa, bb] is a subinterval of [p1, p2] where p1 as well as p2 is a user-provided break point or integration limit, then [aa, bb] has level L if abs(bb-aa) = abs(p2-p1)*2^(-L).
iwork[2*limit], ..., iwork[2*limit+npts2] have no significance for the user.
[in]liworkThe length of iwork[]. (liwork >= 2*limit + npts2)
[out]info= 0: Successful exit
= -4: The argument npts2 had an illegal value (npts2 < 2)
= -8: The argument limit had an illegal value (limit < npts2 - 1)
= -14: The argument lwork had an illegal value (lwork < 4*limit + npts2)
= -16: The argument liwork had an illegal value (liwork < 2*limit + npts2)
= 1: Maximum number of subdivisions allowed has been reached
= 2: Requested tolerance cannot be achieved due to roundoff error
= 3: Bad integrand behavior found in the integration interval
= 4: Algorithm does not converge due to the roundoff error in the extrapolation table
= 5: The integral is probably divergent, or slowly convergent
= 6: Break points are specified outside the integration interval
Reference
SLATEC (QUADPACK)