truncated_normal_rule


truncated_normal_rule, a Python code 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].

Licensing:

The computer code and data files made available on this web page are distributed under the MIT license

Languages:

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

Related Data and Programs:

alpert_rule, a Python code which can set up an alpert quadrature rule for functions which are regular, log(x) singular, or 1/sqrt(x) singular.

annulus_rule, a Python code which computes a quadrature rule for estimating integrals of a function over the interior of a circular annulus in 2d.

disk_rule, a Python code which computes quadrature rules over the interior of the general disk in 2D, with radius RC and center (XC,YC).

disk01_rule, a Python code which computes quadrature rules over the interior of the unit disk in 2D, with center (0,0) and radius 1.

line_ncc_rule, a Python code which computes a Newton Cotes Closed (NCC) quadrature rule, using equally spaced points, over the interior of a line segment in 1D.

quadrule, a Python code which defines quadrature rules for approximating an integral over a 1D domain.

square_minimal_rule, a Python code which returns almost minimal quadrature rules, with exactness up to total degree 55, over the interior of the symmetric square in 2D, by Mattia Festa and Alvise Sommariva.

truncated_normal, a Python code 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,
    Calculation of Gaussian Quadrature Rules,
    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.

Source Code:

OPTION0_TEST is a test included within the text of truncated_normal_rule.py which computes a quadrature rule for the normal distribution, n = 5, mu = 1.0, sigma = 2.0;

OPTION1_TEST is a test included within the text of truncated_normal_rule.py which computes a quadrature rule for the lower truncated normal distribution, n = 9, mu = 2.0, sigma = 0.5, a = 0.0;

OPTION2_TEST is a test included within the text of truncated_normal_rule.py which computes a quadrature rule for the upper truncated normal distribution, n = 9, mu = 2.0, sigma = 0.5, b = 3.0;

OPTION3_TEST is a test included within the text of truncated_normal_rule.py which computes a quadrature rule for the doubly truncated normal distribution, n = 5, mu = 100.0, sigma = 25.0, a = 50.0, b = 100.0;


Last revised on 05 February 2020.