public final class Functions
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static double |
EULER |
static int |
WITH_REPLACEMENT |
static int |
WITHOUT_REPLACEMENT |
| Constructor and Description |
|---|
Functions() |
| Modifier and Type | Method and Description |
|---|---|
static double |
beta(double a,
double b)
This method returns an approximation to the beta function.
|
static double |
betaCDF(double x,
double a,
double b)
The method computes the beta cumulative distribution function.
|
static double |
comb(double n,
int k)
This method computes the number of combinations of a specified number of objects
chosen from a population of a specified size.
|
static double |
factorial(int k)
This method computes the factorial function, the number of permutations of
a specified number of objects.
|
static double |
gamma(double x)
This method computes the gamma function.
|
static double |
gammaCDF(double x,
double a)
This method computes the cumulative distribution function of the gamma distribution
with a specified shape parameter and scale parameter 1.
|
static int |
getIndex(int i,
int n)
This method returns an index between 0 and n - 1, for use in error correcting
in arrays.
|
static double[] |
getProbabilities(double[] a)
This method takes an array of numbers and returns a probability array (nonnegatie numbers that sum to 1).
|
static double |
getProbability(double p)
This method takes a real number and converts it to a probability
(a number between 0 and 1).
|
static int[] |
getSample(int[] p,
int n,
int t)
This method computes a sample of a specified size from a specified population
and of a specified type (with or without replacement).
|
static int[] |
getSample(int m,
int n,
int t)
This method computes a sample of a specified size from a population of
the form 1, 2, ..., m
|
static boolean |
isReal(double x)
This class method tests to see if a specified number is real.
|
static double |
logGamma(double x)
This method computes the log of the gamma function.
|
static double |
perm(double n,
int k)
This method computes the number of permuatations of a specified number of objects
chosen from a population of a specified number of objects.
|
static double[] |
sort(double[] a)
This method sorts an array of doubles.
|
static int[] |
sort(int[] a)
This method sorts an array of integers.
|
public static final int WITHOUT_REPLACEMENT
public static final int WITH_REPLACEMENT
public static final double EULER
public static double[] getProbabilities(double[] a)
a - the array of numberspublic static double getProbability(double p)
p - the given numberpublic static int getIndex(int i,
int n)
i - the given indexn - the specified size of the arraypublic static double perm(double n,
int k)
n - the population sizek - the sample sizepublic static double factorial(int k)
k - the number of objectspublic static double comb(double n,
int k)
n - the population sizek - the sample sizepublic static double logGamma(double x)
x - a positive numberpublic static double gamma(double x)
x - a positive numberpublic static double gammaCDF(double x,
double a)
x - a positive numbera - the shape parameterpublic static double betaCDF(double x,
double a,
double b)
x - a number between 0 and 1a - the left paramterb - the right parameterpublic static double beta(double a,
double b)
a - the left valueb - the right valuepublic static int[] getSample(int[] p,
int n,
int t)
p - the populationn - the sample sizet - the type (0 without replacement, 1 with replacemen);public static int[] getSample(int m,
int n,
int t)
m - the population sizen - the sample sizet - the type (0 without replacement, 1 with replacement)public static double[] sort(double[] a)
a - the array of doublespublic static int[] sort(int[] a)
a - the array of integerspublic static boolean isReal(double x)
x - the number