LearnKit v0.1.3 LearnKit.Math View Source

Math module

Link to this section Summary

Functions

Correlation of two lists

Calculate the covariance of two lists

Division for 2 elements

Calculate the mean from a list of numbers

Scalar multiplication

Calculate standard deviation from a list of numbers

Calculate standard deviation from a list of numbers, with calculated variance

Sum of 2 numbers

Transposing a matrix

Calculate variance from a list of numbers

Calculate variance from a list of numbers, with calculated mean

Vector subtraction

Link to this section Types

Link to this section Functions

Link to this function correlation(x, y) View Source
correlation(list(), list()) :: number()

Correlation of two lists

Examples

iex> LearnKit.Math.correlation([1, 2, 3], [14, 17, 25])
0.9672471299049061
Link to this function covariance(x, y) View Source
covariance(list(), list()) :: number()

Calculate the covariance of two lists

Examples

iex> LearnKit.Math.covariance([1, 2, 3], [14, 17, 25])
5.5
Link to this function division(x, y) View Source
division(number(), number()) :: number()

Division for 2 elements

Examples

iex> LearnKit.Math.division(10, 2)
5.0

Calculate the mean from a list of numbers

Examples

iex> LearnKit.Math.mean([])
nil

iex> LearnKit.Math.mean([1, 2, 3])
2.0
Link to this function scalar_multiply(multiplicator, list) View Source
scalar_multiply(integer(), list()) :: list()

Scalar multiplication

Examples

iex> LearnKit.Math.scalar_multiply(10, [5, 6])
[50, 60]
Link to this function standard_deviation(list) View Source
standard_deviation(list()) :: number()

Calculate standard deviation from a list of numbers

Examples

iex> LearnKit.Math.standard_deviation([])
nil

iex> LearnKit.Math.standard_deviation([1, 2])
0.5
Link to this function standard_deviation_from_variance(list_variance) View Source
standard_deviation_from_variance(number()) :: number()

Calculate standard deviation from a list of numbers, with calculated variance

Examples

iex> LearnKit.Math.standard_deviation_from_variance(1.25)
1.118033988749895

Sum of 2 numbers

Examples

iex> LearnKit.Math.summ(1, 2)
3
Link to this function transpose(m) View Source
transpose(matrix()) :: matrix()

Transposing a matrix

Examples

iex> LearnKit.Math.transpose([[1, 2], [3, 4], [5, 6]])
[[1, 3, 5], [2, 4, 6]]
Link to this function variance(list) View Source
variance(list()) :: number()

Calculate variance from a list of numbers

Examples

iex> LearnKit.Math.variance([])
nil

iex> LearnKit.Math.variance([1, 2, 3, 4])
1.25
Link to this function variance(list, list_mean) View Source
variance(list(), number()) :: number()

Calculate variance from a list of numbers, with calculated mean

Examples

iex> LearnKit.Math.variance([1, 2, 3, 4], 2.5)
1.25
Link to this function vector_subtraction(x, y) View Source
vector_subtraction(list(), list()) :: list()

Vector subtraction

Examples

iex> LearnKit.Math.vector_subtraction([40, 50, 60], [35, 5, 40])
[5, 45, 20]