|
|
◆ qawo()
| void qawo |
( |
double(*)(double) |
f, |
|
|
double |
a, |
|
|
double |
b, |
|
|
double |
omega, |
|
|
int |
integr, |
|
|
double |
epsabs, |
|
|
double |
epsrel, |
|
|
int |
limit, |
|
|
int |
maxp1, |
|
|
double * |
result, |
|
|
double * |
abserr, |
|
|
int * |
neval, |
|
|
int * |
last, |
|
|
double |
work[], |
|
|
int |
lwork, |
|
|
int |
iwork[], |
|
|
int |
liwork, |
|
|
int * |
info |
|
) |
| |
Finite interval adaptive quadrature for oscillatory functions (25-point Clenshaw-Curtis and 15-point Gauss-Kronrod rule)
- Purpose
- The routine calculates an approximation result to a definite integral I = integral of f(x)*w(x) over [a, b] satisfying the requested accuracy, where the weight function w(x) = cos(ω*x) or sin(ω*x).
Result is obtained by the adaptive integration applying a 25-point modified Clenshaw-Curtis rule and a 15-point Gauss-Kronrod rule 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] | omega | Parameter ω in the weight function. |
| [in] | integr | Indicates which weight function is to be used.
= 1: w(x) = cos(ω*x)
= 2: w(x) = sin(ω*x) |
| [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] | limit | Maximum number of subintervals in the partition of the given integration interval [a, b]. (limit >= 1) |
| [in] | maxp1 | Upper bound on the number of Chebyshev moments which can be stored. (maxp1 >= 1)
For the intervals of lengths abs(b-a)*2^(-L), L = 0, 1, ..., maxp1-2. |
| [out] | result | Approximation to I = integral of f(x)*w(x) 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.
work[4*limit], ..., work[4*limit+25*maxp1-1]: Space for storing the Chebyshev moments. |
| [in] | lwork | The length of work[]. (lwork >= 4*limit + 25*maxp1) |
| [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] indicate the subdivision levels of the subintervals, such that iwork[limit+i-1] = L means that the subinterval numbered i is of length abs(b-a)*2^(1-L). |
| [in] | liwork | The length of iwork[]. (liwork >= 2*limit) |
| [out] | info | = 0: Successful exit
= -5: The argument integr had an illegal value (integr != 1 and integr != 2)
= -8: The argument limit had an illegal value (limit < 1)
= -9: The argument maxp1 had an illegal value (maxp1 < 1)
= -15: The argument lwork had an illegal value (lwork < 4*limit + 25*maxp1)
= -17: The argument liwork had an illegal value (lwork < 2*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
= 4: Algorithm does not converge due to the roundoff error in the extrapolation table
= 5: The integral is probably divergent, or slowly convergent |
- Reference
- SLATEC (QUADPACK)
|