Indicado.Math (Indicado v0.0.4) View Source
This is the helper module holding common math functions for Indicado.
Link to this section Summary
Functions
Calculated mean of a given numeric list.
Returns nil
if list is empty.
Calculates standard deviation of a given numeric list.
Returns nil
if list is empty.
Calculates standard deviation of a given numeric list when mean is pre calculated and passed.
Returns nil
if list is empty.
Calculates variance of a given numeric list.
Returns nil
if list is empty.
Calculates variance of a given numeric list when mean is pre calculated and passed.
Returns nil
if list is empty.
Link to this section Functions
Specs
Calculated mean of a given numeric list.
Returns nil
if list is empty.
Examples
iex> Indicado.Math.mean([1, 2, 3, 4])
2.5
iex> Indicado.Math.mean([3, 5, 0, 14])
5.5
iex> Indicado.Math.mean([])
nil
Specs
Calculates standard deviation of a given numeric list.
Returns nil
if list is empty.
Examples
iex> Indicado.Math.stddev([1, 2, 3, 4])
1.118033988749895
iex> Indicado.Math.stddev([5, 10, 15, 20, 40])
12.083045973594572
iex> Indicado.Math.stddev([])
nil
Specs
Calculates standard deviation of a given numeric list when mean is pre calculated and passed.
Returns nil
if list is empty.
Examples
iex> Indicado.Math.stddev([1, 2, 3, 4], 2.5)
1.118033988749895
iex> Indicado.Math.stddev([5, 10, 15, 20, 40], 18)
12.083045973594572
iex> Indicado.Math.stddev([])
nil
Specs
Calculates variance of a given numeric list.
Returns nil
if list is empty.
Examples
iex> Indicado.Math.variance([1, 2, 3, 4])
1.25
iex> Indicado.Math.variance([2, 4, 6, 8])
5.0
iex> Indicado.Math.variance([])
nil
Specs
Calculates variance of a given numeric list when mean is pre calculated and passed.
Returns nil
if list is empty.
Examples
iex> Indicado.Math.variance([1, 2, 3, 4], 2.5)
1.25
iex> Indicado.Math.variance([2, 4, 6, 8], 5.0)
5.0
iex> Indicado.Math.variance([])
nil