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, pin, qin;
        int     k, n;
        // Beta
        x =.5;
        pin = 12.;
        qin = 12.;
        result = Cdf.beta(x, pin, qin);
        System.out.println("beta(.5, 12., 12.) is "+result);
        
        // binomial
        k = 3;
        n = 5;
        pin = .95;
        result = Cdf.binomial(k, n, pin);
        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);
    }
}

Output

beta(.5, 12., 12.) is 0.5000000000000016
binomial(3, 5, .95) is 0.02259250000000004
chi(.15, 2) is 0.07225651367144709
Link to Java source.