Example: The Cumulative Distribution Functions

Various cumulative distribution functions are exercised. Their use in this example typifies the manner in which other functions in the Cdf class would be used.
using System;
using Imsl.Stat;

public class CdfEx1
{
	public static void  Main(String[] args)
	{
		double x, prob, result;
		int p, q, k, n;
		// Beta
		x = .5;
		p = 12;
		q = 12;
		result = Cdf.Beta(x, p, q);
		Console.Out.WriteLine("beta(.5, 12, 12) is " + result);
		
		// Inverse Beta
		x = .5;
		p = 12;
		q = 12;
		result = Cdf.InverseBeta(x, p, q);
		Console.Out.WriteLine("inversebeta(.5, 12, 12) is " + result);
		
		// binomial
		k = 3;
		n = 5;
		prob = .95;
		result = Cdf.Binomial(k, n, prob);
		Console.Out.WriteLine("binomial(3, 5, .95) is " + result);
		
		// Chi
		x = .15;
		n = 2;
		result = Cdf.Chi(x, n);
		Console.Out.WriteLine("chi(.15, 2) is " + result);
		
		// Inverse Chi
		prob = .99;
		n = 2;
		result = Cdf.InverseChi(prob, n);
		Console.Out.WriteLine("inverseChi(.99, 2) is " + result);
	}
}

Output

beta(.5, 12, 12) is 0.500000000000002
inversebeta(.5, 12, 12) is 0.5
binomial(3, 5, .95) is 0.0225925
chi(.15, 2) is 0.0722565136714471
inverseChi(.99, 2) is 9.21034037197624

Link to C# source.