|
|
◆ Deiint_r()
| Sub Deiint_r |
( |
Result As |
Double, |
|
|
Info As |
Long, |
|
|
XX As |
Double, |
|
|
YY As |
Double, |
|
|
IRev As |
Long, |
|
|
Optional Neval As |
Long, |
|
|
Optional Eps As |
Double = 0 |
|
) |
| |
Infinite interval automatic quadrature (double exponential (DE) formula) (reverse communication version)
- Purpose
- This routine computes the integral of f(x) over [-∞, +∞], satisfying the requested accuracy. The integrand f(x) is computed and provided by the user in accordance with IRev.
The result is obtained by the automatic integration applying the double exponential (DE) formula.
The double exponential (DE) formulas (see Defin) for infinite interval [-∞, +∞] is obtained by using the following transformation function. φ(t) = sinh((π/2)sinh(t))
This formula is suitable for the slowly decaying functions.
- Parameters
-
| [out] | Result | Approximation to the integral. |
| [out] | Info | = 0: Successful exit.
= -5: The argument IRev had an illegal value.
= 1: Slow decay on negative side.
= 2: Slow decay on positive side.
= 3: Both of above.
= 4: Insufficient mesh refinement. (Eps too small, singularity within integral interval, etc.) |
| [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 f(XX) 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] | Neval | (Optional)
Number of integrand evaluations. |
| [in] | Eps | (Optional)
Absolute accuracy requested. (default = 1.0e-14)
(If Eps <= 0, the default value will be used) |
- Reference
- (Japanese book) Masatake Mori "FORTRAN77 Numerical Calculation Programming (augmented edition)" Iwanami Shoten (1987)
- Example Program
- Compute the following integral.
∫ 1/(1 + x^2) dx [-∞, +∞] (= π)
Sub Ex_Deiint_r()
Dim Result As Double, Info As Long
Dim XX As Double, YY As Double, IRev As Long
IRev = 0
Do
Call Deiint_r(Result, Info, XX, YY, IRev)
If IRev = 1 Then YY = 1 / (1 + XX ^ 2)
Loop While IRev <> 0
Debug.Print "S =", Result, "S(true) =", Dconst(13)
Debug.Print "Info =", Info
End Sub
Function Dconst(I As Long, Optional Info As Long) As Double Numerical quantities
Sub Deiint_r(Result As Double, Info As Long, XX As Double, YY As Double, IRev As Long, Optional Neval As Long, Optional Eps As Double=0) Infinite interval automatic quadrature (double exponential (DE) formula) (reverse communication versi...
- Example Results
S = 3.14159265358979 S(true) = 3.14159265358979
Info = 0
|