emel/math/algebra
Functions
pub fn cramer_solution(coefficients: List(List(Float)), constants: List(
Float,
)) -> Result(List(Float), String)
The solution of a system of linear equations by using Cramer’s formula.
Coefficients = [
[1.0, 3.0, -2.0],
[3.0, 5.0, 6.0],
[2.0, 4.0, 3.0]
],
Constants = [5.0, 7.0, 8.0],
emel@math@algebra:cramer_solution(Coefficients, Constants).
% {ok, [-15.0, 8.0, 2.0]}
pub fn determinant(matrix: List(List(Float))) -> Float
A value that can be computed from the elements of a square matrix
.
Geometrically, it can be viewed as the scaling factor of the linear transformation described by the matrix
.
Matrix = [
[3.0, 8.0],
[4.0, 6.0]
],
emel@math@algebra:determinant(Matrix).
% -14.0
pub fn first_minor(matrix: List(List(Float)), i: Int, j: Int) -> List(
List(Float),
)
The first_minor
of a matrix
obtained by removing just the i
-row and the j
-column from the matrix
.
It is required for calculating cofactors, which in turn are useful for computing both the determinant
and the inverse of square matrices. i
and j
are zero based.
Matrix = [
[5.0, -7.0, 2.0, 2.0],
[0.0, 3.0, 0.0, -4.0],
[-5.0, -8.0, 0.0, 3.0],
[0.0, 5.0, 0.0, -6.0],
],
I = 0,
J = 2,
emel@math@algebra:first_minor(Matrix, I, J).
% [
% [0.0, 3.0, -4.0],
% [-5.0, -8.0, 3.0],
% [0.0, 5.0, -6.0]
% ]