13 integer(IK) ,
parameter :: NINTMAX
= 1000_IK
14 real(RK) ,
parameter :: ABSTOL
= 0._RK, RELTOL
= epsilon(
0._RK)
* 10000
15 real(RK) :: lb, ub, truth, integral, abserr, sinfo(
4, NINTMAX)
16 integer(IK) :: err, neval, nint, sindex(NINTMAX)
18 type(display_type) :: disp
22 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
23 call disp%show(
"! Compute the Gauss-Kronrod quadrature of the probability density function of the Standard Normal distribution.")
24 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
30 call disp%show(
"lb = -100._RK; ub = +100._RK")
31 lb
= -100._RK; ub
= +100._RK
32 call disp%show(
"err = getQuadErr(getNormPDF, lb, ub, ABSTOL, RELTOL, GK41, integral, abserr, sinfo, sindex, neval, nint)")
33 err = getQuadErr(getNormPDF, lb, ub, ABSTOL, RELTOL,
GK41, integral, abserr, sinfo, sindex, neval, nint)
34 call disp%show(
"if (err /= 0_IK) error stop 'integration failed: err = '//getStr(err)")
35 if (err
/= 0_IK)
error stop 'integration failed: err = '//getStr(err)
36 call disp%show(
"truth = getNormCDF(ub) - getNormCDF(lb)")
38 call disp%show(
"[truth, integral, abserr, abs(integral - truth) / truth]")
39 call disp%show( [truth, integral, abserr, abs(integral
- truth)
/ truth] )
45 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
46 call disp%show(
"! Compute the Gauss-Kronrod quadrature of the probability density function of the Standard LogNormal distribution.")
47 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
53 call disp%show(
"lb = exp(-10._RK); ub = exp(+10._RK)")
54 lb
= exp(
-10._RK); ub
= exp(
+10._RK)
55 call disp%show(
"err = getQuadErr(getLogNormPDF, lb, ub, ABSTOL, RELTOL, GK41, integral, abserr, sinfo, sindex, neval, nint)")
56 err = getQuadErr(getLogNormPDF, lb, ub, ABSTOL, RELTOL,
GK41, integral, abserr, sinfo, sindex, neval, nint)
57 call disp%show(
"if (err /= 0_IK) error stop 'integration failed: err = '//getStr(err)")
58 if (err
/= 0_IK)
error stop 'integration failed: err = '//getStr(err)
59 call disp%show(
"truth = getLogNormCDF(ub) - getLogNormCDF(lb)")
61 call disp%show(
"[truth, integral, abserr, abs(integral - truth) / truth]")
62 call disp%show( [truth, integral, abserr, abs(integral
- truth)
/ truth] )
69 function getIntSinCos(x)
result(integrand)
70 real(RK) ,
intent(in) :: x
72 integrand
= cos(
100._RK * sin(x))
75 function getNormPDF(x)
result(pdf)
77 real(RK) ,
intent(in) :: x
82 function getLogNormPDF(x)
result(pdf)
84 real(RK) ,
intent(in) :: x
Generate and return the Cumulative Distribution Function (CDF) of the univariate Lognormal distributi...
Generate the natural logarithm of probability density function (PDF) of the univariate Lognormal dist...
Generate and return the Cumulative Distribution Function (CDF) of the univariate Normal distribution.
Generate the natural logarithm of probability density function (PDF) of the univariate Normal distrib...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
Compute the 1D integral of the input scalar (potentially singular) integrand getFunc on a finite or s...
Return the Kronrod nodes and weights of the extension to the -point Gauss-Legendre quadrature,...
Generate and return the conversion of the input value to an output Fortran string,...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
type(GK41_type), parameter GK41
The scalar constant object of type GK41_type that indicates the use of 20-point Gauss-Legendre quadra...
This module contains the generic procedures for converting values of different types and kinds to For...
Generate and return an object of type display_type.
8+0.00000000000000000000000000000000000,
+0.192592994438723585305597794258492732E-29
9lb
= -100._RK; ub
= +100._RK
10err = getQuadErr(getNormPDF, lb, ub, ABSTOL, RELTOL,
GK41, integral, abserr, sinfo, sindex, neval, nint)
11if (err
/= 0_IK)
error stop 'integration failed: err = '//getStr(err)
12truth
= getNormCDF(ub)
- getNormCDF(lb)
13[truth, integral, abserr, abs(integral
- truth)
/ truth]
14+1.00000000000000000000000000000000000,
+1.00000000000000000000000000000000019,
+0.348826834552332163342274808104495182E-30,
+0.192592994438723585305597794258492732E-33
25+0.00000000000000000000000000000000000,
+0.192592994438723585305597794258492732E-29
26lb
= exp(
-10._RK); ub
= exp(
+10._RK)
27err = getQuadErr(getLogNormPDF, lb, ub, ABSTOL, RELTOL,
GK41, integral, abserr, sinfo, sindex, neval, nint)
28if (err
/= 0_IK)
error stop 'integration failed: err = '//getStr(err)
29truth
= getLogNormCDF(ub)
- getLogNormCDF(lb)
30[truth, integral, abserr, abs(integral
- truth)
/ truth]
31+0.999999999999999999999984760293951620,
+0.999999999999999999999984760293951620,
+0.952513811497278733282817811682810727E-32,
+0.00000000000000000000000000000000000