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
Correlation of two lists
Examples
iex> LearnKit.Math.correlation([1, 2, 3], [14, 17, 25])
0.9672471299049061
Calculate the covariance of two lists
Examples
iex> LearnKit.Math.covariance([1, 2, 3], [14, 17, 25])
5.5
Calculate the mean from a list of numbers
Examples
iex> LearnKit.Math.mean([])
nil
iex> LearnKit.Math.mean([1, 2, 3])
2.0
Scalar multiplication
Examples
iex> LearnKit.Math.scalar_multiply(10, [5, 6])
[50, 60]
Calculate standard deviation from a list of numbers
Examples
iex> LearnKit.Math.standard_deviation([])
nil
iex> LearnKit.Math.standard_deviation([1, 2])
0.5
Calculate standard deviation from a list of numbers, with calculated variance
Examples
iex> LearnKit.Math.standard_deviation_from_variance(1.25)
1.118033988749895
Transposing a matrix
Examples
iex> LearnKit.Math.transpose([[1, 2], [3, 4], [5, 6]])
[[1, 3, 5], [2, 4, 6]]
Calculate variance from a list of numbers
Examples
iex> LearnKit.Math.variance([])
nil
iex> LearnKit.Math.variance([1, 2, 3, 4])
1.25
Calculate variance from a list of numbers, with calculated mean
Examples
iex> LearnKit.Math.variance([1, 2, 3, 4], 2.5)
1.25
Vector subtraction
Examples
iex> LearnKit.Math.vector_subtraction([40, 50, 60], [35, 5, 40])
[5, 45, 20]