Существует также недавний пакет, разработанный для обучения Линейная алгебра ( matlib ), который вычисляет эшелонную форму матрицы и показывает шаги, используемые на этом пути.
Пример из справочных документов :
library('matlib')
A <- matrix(c(2, 1, -1,-3, -1, 2,-2, 1, 2), 3, 3, byrow=TRUE)
b <- c(8, -11, -3)
echelon(A, b, verbose=TRUE, fractions=TRUE)
Initial matrix:
[,1] [,2] [,3] [,4]
[1,] 2 1 -1 8
[2,] -3 -1 2 -11
[3,] -2 1 2 -3
row: 1
exchange rows 1 and 2
[,1] [,2] [,3] [,4]
[1,] -3 -1 2 -11
[2,] 2 1 -1 8
[3,] -2 1 2 -3
multiply row 1 by -1/3
[,1] [,2] [,3] [,4]
[1,] 1 1/3 -2/3 11/3
[2,] 2 1 -1 8
[3,] -2 1 2 -3
multiply row 1 by 2 and subtract from row 2
[,1] [,2] [,3] [,4]
[1,] 1 1/3 -2/3 11/3
[2,] 0 1/3 1/3 2/3
[3,] -2 1 2 -3
multiply row 1 by 2 and add to row 3
[,1] [,2] [,3] [,4]
[1,] 1 1/3 -2/3 11/3
[2,] 0 1/3 1/3 2/3
[3,] 0 5/3 2/3 13/3
row: 2
exchange rows 2 and 3
[,1] [,2] [,3] [,4]
[1,] 1 1/3 -2/3 11/3
[2,] 0 5/3 2/3 13/3
[3,] 0 1/3 1/3 2/3
multiply row 2 by 3/5
[,1] [,2] [,3] [,4]
[1,] 1 1/3 -2/3 11/3
[2,] 0 1 2/5 13/5
[3,] 0 1/3 1/3 2/3
multiply row 2 by 1/3 and subtract from row 1
[,1] [,2] [,3] [,4]
[1,] 1 0 -4/5 14/5
[2,] 0 1 2/5 13/5
[3,] 0 1/3 1/3 2/3
multiply row 2 by 1/3 and subtract from row 3
[,1] [,2] [,3] [,4]
[1,] 1 0 -4/5 14/5
[2,] 0 1 2/5 13/5
[3,] 0 0 1/5 -1/5
row: 3
multiply row 3 by 5
[,1] [,2] [,3] [,4]
[1,] 1 0 -4/5 14/5
[2,] 0 1 2/5 13/5
[3,] 0 0 1 -1
multiply row 3 by 4/5 and add to row 1
[,1] [,2] [,3] [,4]
[1,] 1 0 0 2
[2,] 0 1 2/5 13/5
[3,] 0 0 1 -1
multiply row 3 by 2/5 and subtract from row 2
[,1] [,2] [,3] [,4]
[1,] 1 0 0 2
[2,] 0 1 0 3
[3,] 0 0 1 -1