Statistics.Math.Functions

Summary

beta(x, y)

The Beta function

erf(x)

The ‘error’ function

gamma(x)

The Gamma function

gammainc(a, x)

Lower incomplete Gamma function

hyp2f1(a, b, c, x)

Hypergeometrc 2F1 functiono

inv_erf(x)

The inverse ‘error’ function

simpson(f, a, b, n)

Simpsons rule for numerical intergation of a function

Functions

beta(x, y)

The Beta function

Examples

iex> Statistics.Math.Functions.beta(2, 0.5)
1.3333333333333328
erf(x)

The ‘error’ function

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

gamma(x)

The Gamma function

This implementation uses the Lanczos approximation

Examples

iex> Statistics.Math.Functions.gamma(0.5)
1.7724538509055163
gammainc(a, x)

Lower incomplete Gamma function

Examples

iex> Statistics.Math.Functions.gammainc(1,1)
0.63212055882855778
hyp2f1(a, b, c, x)

Hypergeometrc 2F1 functiono

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

inv_erf(x)

The inverse ‘error’ function

simpson(f, a, b, n)

Simpsons rule for numerical intergation 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