public class Maths
extends java.lang.Object
README
.Modifier and Type | Field and Description |
---|---|
static double |
epsilon
A tiny amount, epsilon, to allow for rounding error where necessary.
|
static double |
twoPI
twoPI = 2π.
|
Constructor and Description |
---|
Maths() |
Modifier and Type | Method and Description |
---|---|
static double |
Bessel_I_asymptotic(double alpha,
double x)
For "large" x, uses Hankel's asymptotic expansion.
|
static double |
Bessel_I_series(double alpha,
double x)
For "small" x, uses the series expansion.
|
static double |
Bessel_I(double alpha,
double x)
Iα(x), the modified Bessel function of the 1st kind;
|
static double |
Bessel_I2(double alpha,
double x)
Uses
Bessel_I_series(,)
for "small" x, Bessel_I_asymptotic(,)
for "large" x, and both at the cross-over (continuity). |
static long |
catalan(int N)
Return the Nth Catalan number, N ≥ 0.
|
static long |
cummulativeCatalans(int N)
Return ∑i=0..N
catalan(i) , N≥0. |
static double |
Gamma(double x)
Math.exp(
logGamma(x) ), for real x. |
static double |
log_nCk(int n,
int k)
loge(nCk).
|
static double |
logBeta(double x,
double y)
The log Beta (β) function, log(Β(x,y)), returns
logΓ (x)+logΓ(y)-logΓ(x+y) |
static double |
logFactorial(double x)
Implemented as
logGamma(x+1) . |
static double |
logFactorial(int n)
Implemented as
logGamma(n+1) . |
static double |
logGamma(double x)
log(Γ(x)), real x>0;
|
static double |
logSum(double[] nlXs)
'logSum', aka 'logPlus',
|
static double |
logSum(double nlX,
double nlY)
Equivalent to
logSum ({nlX, nlY}), |
static void |
main(java.lang.String[] args) |
static boolean |
nearlyEqual(double x,
double y)
Is |x-y| ≤ a standard '
epsilon '-fraction
of |
static boolean |
nearlyEqual(double x,
double y,
double epsilon)
Is |x-y| ≤ an epsilon-fraction of
|
static double[] |
nlPrs2odds(double[] nlPr)
Convert an array, nlPr, of message lengths (negative log probabilities)
into a normalised array of probabilities.
|
static void |
nlPrs2odds(double[] nlPr,
double[] pr)
Convert an array, nlPr, of negative log probabilities
into a normalised array of probabilities, pr.
|
public static final double epsilon
public static final double twoPI
public static boolean nearlyEqual(double x, double y)
epsilon
'-fraction
of public static boolean nearlyEqual(double x, double y, double epsilon)
public static double log_nCk(int n, int k)
logFactorial
.public static double logSum(double[] nlXs)
public static double logSum(double nlX, double nlY)
logSum
({nlX, nlY}),public static double[] nlPrs2odds(double[] nlPr)
nlPrs2odds(double[],double[])
.public static void nlPrs2odds(double[] nlPr, double[] pr)
public static long catalan(int N)
cummulativeCatalans(N)
.public static long cummulativeCatalans(int N)
catalan(i)
, N≥0.
Takes O(N)-time.public static double Gamma(double x)
logGamma(x)
), for real x. Note,
public static double logFactorial(int n)
logGamma(n+1)
.public static double logFactorial(double x)
logGamma(x+1)
.public static double logGamma(double x)
logFactorial
.public static double logBeta(double x, double y)
logΓ
(x)+logΓ(y)-logΓ(x+y)public static double Bessel_I(double alpha, double x)
public static double Bessel_I2(double alpha, double x)
Bessel_I_series(,)
for "small" x, Bessel_I_asymptotic(,)
for "large" x, and both at the cross-over (continuity).public static double Bessel_I_series(double alpha, double x)
public static double Bessel_I_asymptotic(double alpha, double x)
public static void main(java.lang.String[] args)