statistics v0.5.0 Statistics.Math.Functions

Link to this section Summary

Functions

The Beta function

The ‘error’ function

The Gamma function

Lower incomplete Gamma function

Hypergeometrc 2F1 functiono

The inverse ‘error’ function

Simpsons rule for numerical integration of a function

Link to this section Functions

Link to this function beta(x, y)
beta(number(), number()) :: number()

The Beta function

Examples

iex> Statistics.Math.Functions.beta(2, 0.5)
1.3333333333333324
Link to this function erf(x)
erf(number()) :: number()

The ‘error’ function

Formula 7.1.26 given in Abramowitz and Stegun. Formula appears as 1 – (a1t1 + a2t2 + a3t3 + a4t4 + a5t5)exp(-x2)

Link to this function gamma(x)
gamma(number()) :: number()

The Gamma function

This implementation uses the Lanczos approximation

Examples

iex> Statistics.Math.Functions.gamma(0.5)
1.7724538509055159
Link to this function gammainc(a, x)
gammainc(number(), number()) :: number()

Lower incomplete Gamma function

Examples

iex> Statistics.Math.Functions.gammainc(1,1)
0.63212055882855778
Link to this function hyp2f1(a, b, c, x)
hyp2f1(number(), number(), number(), number()) :: number()

Hypergeometrc 2F1 functiono

WARNING: the implementation is incomplete, and should not be used

Link to this function inv_erf(x)
inv_erf(number()) :: number()

The inverse ‘error’ function

Link to this function simpson(f, a, b, n)
simpson((... -> any()), number(), number(), number()) :: number()

Simpsons rule for numerical integration of a function

see: http://en.wikipedia.org/wiki/Simpson’s_rule

Examples

iex> Statistics.Math.Functions.simpson(fn x -> x*x*x end, 0, 20, 100000)
40000.00000000011