|
|
◆ Qawo_r()
| Sub Qawo_r |
( |
A As |
Double, |
|
|
B As |
Double, |
|
|
Omega As |
Double, |
|
|
Integr As |
Long, |
|
|
Result As |
Double, |
|
|
Info As |
Long, |
|
|
XX As |
Double, |
|
|
YY As |
Double, |
|
|
IRev As |
Long, |
|
|
Optional AbsErr As |
Double, |
|
|
Optional Neval As |
Long, |
|
|
Optional EpsAbs As |
Double = -1, |
|
|
Optional EpsRel As |
Double = -1, |
|
|
Optional Limit As |
Long = -1, |
|
|
Optional Last As |
Long, |
|
|
Optional Maxp1 As |
Long = -1 |
|
) |
| |
Finite interval adaptive quadrature for oscillatory functions (25-point Clenshaw-Curtis and 15-point Gauss-Kronrod rule) (reverse communication version)
- 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] | A | Lower limit of integration a. |
| [in] | B | Upper limit of integration b. |
| [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) |
| [out] | Result | Approximation to the integral. |
| [out] | Info | = 0: Successful exit.
= -5: The argument Integr had an illegal value. (Integr <> 1 and Integr <> 2)
= 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. |
| [out] | XX | When returned with IRev = 1, XX contains the abscissa where the function value should be evaluated and given in the next call. |
| [in] | YY | When returned with IRev = 1, the function value should be given in YY in the next call. |
| [in,out] | IRev | Control variable for reverse communication.
[in] Before first call, IRev should be initialized to zero. On succeeding calls, IRev should not be altered.
[out] If IRev is not zero, complete the following tasks and call this routine again without changing IRev.
= 0: Computation finished. See return code in Info.
= 1: User should set the function values at XX in YY. Do not alter any variables other than YY. |
| [out] | AbsErr | (Optional)
Estimate of the modulus of the absolute error, which should equal or exceed the true error. |
| [out] | Neval | (Optional)
Number of integrand evaluations. |
| [in] | EpsAbs | (Optional)
Absolute accuracy requested. (default = 0)
The requested accuracy is assumed to be satisfied if AbsErr <= max(EpsAbs, EpsRel*|Result|))
(If EpsAbs < 0, the default value will be used) |
| [in] | EpsRel | (Optional)
Relative accuracy requested. (default = 1.0e-12)
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.
(If EpsRel < 0, the default value will be used) |
| [in] | Limit | (Optional)
Maximum number of subintervals in the partition of the given integration interval [a, b] (limit >= 1) (default = 100)
(If Limit < 1, the default value will be used) |
| [out] | Last | (Optional)
Number of subintervals produced in the subdivision process. |
| [in] | Maxp1 | (Optional)
Upper bound on the number of Chebyshev moments which can be stored (Maxp1 >= 1) (default = 21)
(If Maxp1 < 1, the default value will be used) |
- Reference
- SLATEC (QUADPACK)
- Example Program
- Compute the following integral.
∫ ln(x)sin(10πx) dx [0, 1] (= -0.1281368)
Sub Ex_Qawo_r()
Dim A As Double, B As Double, Result As Double, Info As Long
Dim Omega As Double, Integr As Long
Dim XX As Double, YY As Double, IRev As Long
A = 0: B = 1
Omega = 10 * Dconst(13) '10*π
Integr = 2
IRev = 0
Do
Call Qawo_r(A, B, Omega, Integr, Result, Info, XX, YY, IRev)
If IRev = 1 Then
YY = 0
If XX > 0 Then YY = Log(XX)
End If
Loop While IRev <> 0
Debug.Print "S =", Result
Debug.Print "Info =", Info
End Sub
- Example Results
S = -0.128136848399167
Info = 0
|