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.
import com.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);
        System.out.println("beta(.5, 12, 12) is "+result);
        
        // Inverse Beta
        x =.5;
        p = 12;
        q = 12;
        result = Cdf.inverseBeta(x, p, q);
        System.out.println("inversebeta(.5, 12, 12) is "+result);
        
        // binomial
        k = 3;
        n = 5;
        prob = .95;
        result = Cdf.binomial(k, n, prob);
        System.out.println("binomial(3, 5, .95) is "+result);
        
        // Chi
        x = .15;
        n = 2;
        result = Cdf.chi(x, n);
        System.out.println("chi(.15, 2) is "+result);
        
        // Inverse Chi
        prob = .99;
        n = 2;
        result = Cdf.inverseChi(prob, n);
        System.out.println("inverseChi(.99, 2) is "+result);
    }
}

Output

beta(.5, 12, 12) is 0.5000000000000016
inversebeta(.5, 12, 12) is 0.4999999999999991
binomial(3, 5, .95) is 0.02259250000000004
chi(.15, 2) is 0.07225651367144711
inverseChi(.99, 2) is 9.210340371976306
Link to Java source.