Learn R Programming

matlib (version 0.8.1)

showEqn: Show Matrices (A, b) as Linear Equations

Description

Shows what matrices \(A, b\) look like as the system of linear equations, \(A x = b\), but written out as a set of equations.

Usage

showEqn(A, b, vars, simplify = FALSE, fractions = FALSE, latex = FALSE)

Arguments

A

either the matrix of coefficients of a system of linear equations, or the matrix cbind(A,b)

b

if supplied, the vector of constants on the right hand side of the equations

vars

a numeric or character vector of names of the variables. If supplied, the length must be equal to the number of unknowns in the equations. The default is paste0("x", 1:ncol(A).

simplify

logical; try to simplify the equations?

fractions

logical; express numbers as rational fractions?

latex

logical; print equations in a form suitable for LaTeX output?

Value

a one-column character matrix, one row for each equation

See Also

plotEqn, plotEqn3d

Examples

Run this code
# NOT RUN {
  A <- matrix(c(2, 1, -1,
               -3, -1, 2,
               -2,  1, 2), 3, 3, byrow=TRUE)
  b <- c(8, -11, -3)
  showEqn(A, b)
  # show numerically
  x <- solve(A, b)
  showEqn(A, b, vars=x)

  showEqn(A, b, simplify=TRUE)
  showEqn(A, b, latex=TRUE)
# }

Run the code above in your browser using DataLab