Learn R Programming

matlib (version 0.6.0)

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)

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?

Value

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

See Also

plotEqn, plotEqn3d

Examples

Run this code
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)

Run the code above in your browser using DataLab