Gaussian (Standard Normal) Distribution



Gaussian Distribution

The distribution function of a random variable X distributed according to the Gaussian distribution is a continuous function, F(x) = P(X < x), given by
F(x) =
[ 1 / √(2π) ] ∫-∞x e -½ t² dt for -∞ < x < ∞


The corresponding probability density function, f(x) = dF(x)/dx, is
f(x) =
[ 1 / √(2π) ] e -½ x² for -∞ < x < ∞

Function List

  • double Gaussian_Distribution( double x )

    This function returns F(x) where F(x) is described above.

  • double Gaussian_Density( double x )

    This function returns f(x) where f(x) is described above.

  • void Gaussian_Distribution_Tables( double start, double delta, int nsteps, double *density, double* distribution_function )

    This function returns f(x) where f(x) is described above in the array density, i.e. density[i] = f(xi) where xi = start + i delta, i = 0,...,nsteps and returns F(x) where F(x) is described above in the array distribution_function, i.e. distribution_function[i] = F(xi) where xi = start + i delta, i = 0,...,nsteps. Note that density must be declared double density[N] where N ≥ nsteps + 1 in the calling routine and similarly the distribution_function must be declared double distribution_function[N] where
    N ≥ nsteps + 1 in the calling routine.

Source Code

C source code is available for these routines:
  • The file, gaussian_distribution.c, contains the source code for the function Gaussian_Distribution().

    Dependencies: No external dependencies.

  • The file, gaussian_density.c contains the source code for the function Gaussian_Density().

    Dependencies: No external dependencies.

  • The file, gaussian_dist_tables.c contains the source code for the function Gaussian_Distribution_Tables().

    Dependencies: In addition to the the file gaussian_dist_tables.c, the function Gaussian_Distribution_Tables() requires the following files:

    • The file gaussian_distribution.c.
    • The file gaussian_density.c.


C Test Code, Test Results, and Build Shell Script

  • The file, testgaussdist.c, contains a test program of Gaussian_Distribution( ) written in C. This test program requires the file gaussian_distribution.c listed above.

  • The file, GaussianDistributionTest.txt, contains the results of the test program testgaussdist.c.

  • The file, testgaussdist.sh, contains the shell script used to compile, link, and execute the test program testgaussdist.c.



  • The file, testgaussdensity.c, contains a test program of Gaussian_Density( ) written in C. This test program requires the file gaussian_density.c listed above.

  • The file, GaussianDensityTest.txt, contains the results of the test program testgaussdensity.c.

  • The file, testgaussdensity.sh, contains the shell script used to compile, link, and execute the test program testgaussdensity.c.



  • The file, testgausstables.c, contains a test program of Gaussian_Distribution_Tables( ) written in C. This test program requires the files gaussian_distribution.c and gaussian_density.c listed above.

  • The file, GaussianTablesTest.txt, contains the results of the test program testgausstables.c.

  • The file, testgausstables.sh, contains the shell script used to compile, link, and execute the test program testgausstables.c.