A <- matrix(c(2, 1, -1,
-3, -1, 2,
-2, 1, 2), 3, 3, byrow=TRUE)
b <- c(8, -11, -3)
gaussianElimination(A, b)
gaussianElimination(A, b, verbose=TRUE, fractions=TRUE)
gaussianElimination(A, b, verbose=TRUE, fractions=TRUE, latex=TRUE)
# determine whether matrix is solvable
gaussianElimination(A, numeric(3))
# find inverse matrix by elimination: A = I -> A^-1 A = A^-1 I -> I = A^-1
gaussianElimination(A, diag(3))
inv(A)
# works for 1-row systems (issue # 30)
A2 <- matrix(c(1, 1), nrow=1)
b2 = 2
gaussianElimination(A2, b2)
showEqn(A2, b2)
# plotEqn works for this case
plotEqn(A2, b2)
Run the code above in your browser using DataLab