# Student's t Distribution with 2 Degrees of Freedom

The distribution function of a random variable X distributed according to the Student's t distribution with 2 degrees of freedom is the continuous function, F(x) = P(X < x), given by
F(x) =
 [ 1 + x / √(2 + x 2) ] / 2 for -∞ < x < ∞

The corresponding probability density function, f(x) = dF(x)/dx, is
f(x) =
 [ 1 / ( n½ B(1/2,n/2) ) ] (1 + x² / n) -(n+1) / 2

#### Function List

• double t2_Distribution( double x )

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

• double t2_Density( double x )

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

• void t2_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 this routine:
• The file, t2_distribution.c, contains the source code for the function t2_Distribution.

Dependencies: No external dependencies.

• The file, t2_density.c, contains the source code for the function t2_Density.

Dependencies: No external dependencies.

• The file, t2_dist_tables.c, contains the source code for the function t2_Distribution_Tables.

Dependencies: No external dependencies.

#### C Test Code, Test Results, and Build Shell Script

• The file, testt2dist.c, contains a test program of t2_Distribution( ) written in C. This test program requires the file t2_distribution.c.

• The file, T2DistributionTest.txt, contains the results of the test program testt2dist.c.

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

• The file, testt2density.c, contains a test program of t2_Density( ) written in C. This test program requires the file t2_density.c.

• The file, T2DensityTest.txt, contains the results of the test program testt2density.c.

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

• The file, testt2tables.c, contains a test program of t2_Distribution_Tables( ) written in C. This test program requires the files t2_distribution.c and t2_density.c listed above.

• The file, T2TablesTest.txt, contains the results of the test program testt2tables.c.

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