|
|
◆ Qawc()
| Sub Qawc |
( |
F As |
LongPtr, |
|
|
A As |
Double, |
|
|
B As |
Double, |
|
|
C As |
Double, |
|
|
Result As |
Double, |
|
|
Info 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 |
|
) |
| |
Finite interval adaptive quadrature for Cauchy principal values (25-point Clenshaw-Curtis and 15-point Gauss-Kronrod rule)
- Purpose
- The routine calculates an approximation result to a Cauchy principal value I = integral of f(x)*w(x) over [a, b] satisfying the requested accuracy, where the weight function w(x) = 1/(x - c).
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. Function F(X As Double) As Double
F = f(X)
End Function
X should not be changed. |
| [in] | A | Lower limit of integration a. |
| [in] | B | Upper limit of integration b. |
| [in] | C | Parameter in the weight function. (C <> A and C <> B) |
| [out] | Result | Cauchy principal value of the integral of f(x)/(x - c) over [a, b] |
| [out] | Info | = 0: Successful exit.
= -4: The argument C had an illegal value. (C = A or C = B)
= 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. |
| [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. |
- Reference
- SLATEC (QUADPACK)
- Example Program
- Compute the following integral.
∫ 1/(x*(5*x^3 + 6)) dx [-1, 5] (= -0.08994401)
Function F3(X As Double) As Double
F3 = 1 / (5 * X ^ 3 + 6)
End Function
Sub Ex_Qawc()
Dim A As Double, B As Double, C As Double, Result As Double, Info As Long
A = -1: B = 5: C = 0
Call Qawc(AddressOf F3, A, B, C, Result, Info)
Debug.Print "S =", Result
Debug.Print "Info =", Info
End Sub
Sub Qawc(F As LongPtr, A As Double, B As Double, C As Double, Result As Double, Info 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) Finite interval adaptive quadrature for Cauchy principal values (25-point Clenshaw-Curtis and 15-poin...
- Example Results
S = -8.99440069577173E-02
Info = 0
|