Statistics.MathHelpers
Summary
e() | The constant e |
exp(x) | Exponent function |
ln(i) | The natural log |
pi() | The constant pi |
pow(num, pow) | Get power from Erlang |
rand() | Get a random number from erlang |
round(x, precision) | Round a decimal to a specific precision |
sqrt(num) | Get square root |
Functions
The natural log
( from Erlang Math module)
Examples
iex> Statistics.MathHelpers.ln(20)
2.995732273553991
iex> Statistics.MathHelpers.ln(200)
5.298317366548036
The constant pi
(returned from Erlang Math module)
Examples
iex> Statistics.MathHelpers.pi
3.141592653589793
Get power from Erlang
This is needed because Elixir doesn’t
currently have the **
operator
Examples
iex> Statistics.MathHelpers.pow(2,3)
8.0
iex> Statistics.MathHelpers.pow(9,9)
387420489.0
Round a decimal to a specific precision
Examples
iex> Statistics.MathHelpers.round(0.123456, 4)
0.1235