|
|
◆ qag()
| void qag |
( |
double(*)(double) |
f, |
|
|
double |
a, |
|
|
double |
b, |
|
|
double |
epsabs, |
|
|
double |
epsrel, |
|
|
int |
key, |
|
|
int |
limit, |
|
|
double * |
result, |
|
|
double * |
abserr, |
|
|
int * |
neval, |
|
|
int * |
last, |
|
|
double |
work[], |
|
|
int |
lwork, |
|
|
int |
iwork[], |
|
|
int * |
info |
|
) |
| |
Finite interval adaptive quadrature (15/21/31/41/51/61 point Gauss-Kronrod rule)
- Purpose
- This routine computes I = integral of f over [a, b], satisfying the requested accuracy, where f is a given function defined by a user supplied subroutine.
15, 21, 31, 41, 51 or 61 point Gauss-Kronrod rule is used, and the integration interval will be adaptively subdivided to satisfy the requested accuracy.
- Parameters
-
| [in] | f | The user supplied subroutine which calculates the integrand function f(x) defined as follows. double f(double x)
{
return computed f(x) value
}
|
| [in] | a | Lower limit of integration. |
| [in] | b | Upper limit of integration. |
| [in] | epsabs | Absolute accuracy requested.
The requested accuracy is assumed to be satisfied if abserr <= max(epsabs, epsrel*|result|)). |
| [in] | epsrel | Relative 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] | key | Key for choice of local integration rule.
= 1: qk15
= 2: qk21
= 3: qk31
= 4: qk41
= 5: qk51
= 6: qk61
If key < 1, key = 1 is assumed. If key > 6, key = 6 is assumed. |
| [in] | limit | Maximum number of subintervals in the partition of the given integration interval [a, b]. (limit >= 1) |
| [out] | result | Approximation to I = integral of f over [a, b]. |
| [out] | abserr | Estimate of the modulus of the absolute error, which should equal or exceed the true error. |
| [out] | neval | Number of integrand evaluations. |
| [out] | last | Number 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. |
| [in] | lwork | The length of work[]. (lwork >= 4*limit) |
| [out] | iwork[] | Array iwork[liwork] (liwork >= limit)
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. |
| [out] | info | = 0: Successful exit
= -7: The argument limit had an illegal value (limit < 1)
= -13: The argument lwork had an illegal value (lwork < 4*limit)
= 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 |
- Reference
- SLATEC (QUADPACK)
|