|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnr.SpecialFunctions
public class SpecialFunctions
Some useful functions
Method Summary | |
---|---|
static double |
chisq(double x,
double n)
chi square distribution. |
static double |
logGamma(double x)
Returns the natural logarithm of the gamma function. |
static double |
randomExponential(double n)
sum of n random exponentials. |
static double |
randomGaussian(double dev)
random gaussian with a given standard deviation |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double randomGaussian(double dev)
public static double randomExponential(double n)
p(x) = exp(-x)
n
- the number of exponentials to add. A double, for
flexibility with the rest of the program. If n does not represent an integer,
for small n uses floor(n); for large n uses a function approximation that
effectively interpolates between floor(n) and floor(n)+1.
java.lang.IllegalArgumentException
- if n < 1public static double chisq(double x, double n)
x
- the sum-of-squaresn
- the "degrees of freedom": the number of sums-of-squares minus
the number of fitted parameters.
java.lang.IllegalArgumentException
- if x < 0 or n <= 0
java.lang.ArithmeticException
- if the function cannot be estimatedpublic static double logGamma(double x) throws java.lang.ArithmeticException
Implementation:
x
- the argument to the function
java.lang.ArithmeticException
- if the function overflows
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |