TRUNCATED_NORMAL_RULE Quadrature Rule for Truncated Normal Distribution

TRUNCATED_NORMAL_RULE, a C++ program which computes a quadrature rule for a normal probability density function (PDF), sometimes called a Gaussian distribution, that has been truncated to [A,+oo), (-oo,B] or [A,B].

Languages:

TRUNCATED_NORMAL_RULE is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

CHEBYSHEV1_RULE, a C++ program which can compute and print a Gauss-Chebyshev type 1 quadrature rule.

CHEBYSHEV2_RULE, a C++ program which can compute and print a Gauss-Chebyshev type 2 quadrature rule.

CLENSHAW_CURTIS_RULE, a C++ program which defines a Clenshaw Curtis quadrature rule.

GEGENBAUER_RULE, a C++ program which can compute and print a Gauss-Gegenbauer quadrature rule.

GEN_HERMITE_RULE, a C++ program which can compute and print a generalized Gauss-Hermite quadrature rule.

GEN_LAGUERRE_RULE, a C++ program which can compute and print a generalized Gauss-Laguerre quadrature rule.

HERMITE_RULE, a C++ program which can compute and print a Gauss-Hermite quadrature rule.

JACOBI_RULE, a C++ program which can compute and print a Gauss-Jacobi quadrature rule.

LAGUERRE_RULE, a C++ program which can compute and print a Gauss-Laguerre quadrature rule.

LEGENDRE_RULE, a C++ program which can compute and print a Gauss-Legendre quadrature rule.

LINE_FELIPPA_RULE, a C++ library which returns the points and weights of a Felippa quadrature rule over the interior of a line segment in 1D.

PATTERSON_RULE, a C++ program which computes a Gauss-Patterson quadrature rule.

TRUNCATED_NORMAL, a C++ library which works with the truncated normal distribution over [A,B], or [A,+oo) or (-oo,B], returning the probability density function (PDF), the cumulative density function (CDF), the inverse CDF, the mean, the variance, and sample values.

Reference:

1. Gene Golub, John Welsch,
Mathematics of Computation,
Volume 23, Number 106, April 1969, pages 221-230.
2. Norman Johnson, Samuel Kotz, Narayanaswamy Balakrishnan,
Continuous Univariate Distributions,
Second edition,
Wiley, 1994,
ISBN: 0471584940,
LC: QA273.6.J6.

Examples and Tests:

"OPTION0" computes a quadrature rule for the normal distribution, n = 5, mu = 1.0, sigma = 2.0;

"OPTION1" computes a quadrature rule for the lower truncated normal distribution, n = 9, mu = 2.0, sigma = 0.5, a = 0.0;

"OPTION2" computes a quadrature rule for the upper truncated normal distribution, n = 9, mu = 2.0, sigma = 0.5, b = 3.0;

"OPTION3" computes a quadrature rule for the doubly truncated normal distribution, n = 5, mu = 100.0, sigma = 25.0, a = 50.0, b = 100.0;

List of Routines:

• MAIN is the main program for TRUNCATED_NORMAL_RULE.
• JACOBI_EIGENVALUE carries out the Jacobi eigenvalue iteration.
• MOMENT_METHOD computes a quadrature rule by the method of moments.
• MOMENTS_NORMAL returns moments of the standard Normal distribution.
• MOMENTS_TRUNCATED_NORMAL_AB: moments of truncated Normal distribution.
• MOMENTS_TRUNCATED_NORMAL_A: moments of lower truncated Normal distribution.
• MOMENTS_TRUNCATED_NORMAL_B: moments of upper truncated Normal distribution.
• NORMAL_01_CDF evaluates the Normal 01 CDF.
• NORMAL_01_PDF evaluates the Normal 01 PDF.
• R8_CHOOSE computes the binomial coefficient C(N,K) as an R8.
• R8_FACTORIAL computes the factorial of N.
• R8_FACTORIAL2 computes the double factorial function.
• R8_HUGE returns a very large R8.
• R8_MOP returns the I-th power of -1 as an R8.
• R8MAT_CHOLESKY_FACTOR_UPPER: upper Cholesky factor of a symmetric matrix.
• R8MAT_PRINT prints an R8MAT.
• R8MAT_PRINT_SOME prints some of an R8MAT.
• R8MAT_WRITE writes an R8MAT file.
• R8VEC_PRINT prints an R8VEC.
• RULE_WRITE writes a quadrature rule to a file.
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• TRUNCATED_NORMAL_AB_MOMENT: moments of the truncated Normal PDF.
• TRUNCATED_NORMAL_A_MOMENT: moments of the lower truncated Normal PDF.
• TRUNCATED_NORMAL_B_MOMENT: moments of the upper truncated Normal PDF.

You can go up one level to the C++ source codes.

Last revised on 20 September 2013.