Last chance! 50% off unlimited learning
Sale ends in
Shows what matrices
plotEqn(
A,
b,
vars,
xlim,
ylim,
col = 1:nrow(A),
lwd = 2,
lty = 1,
axes = TRUE,
labels = TRUE,
solution = TRUE
)
nothing; used for the side effect of making a plot
either the matrix of coefficients of a system of linear equations, or the matrix cbind(A,b)
.
The A
matrix must have two columns.
if supplied, the vector of constants on the right hand side of the equations, of length matching
the number of rows of A
.
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, i.e., 2.
The default is c(expression(x[1]), expression(x[2]))
.
horizontal axis limits for the first variable
vertical axis limits for the second variable; if missing, ylim
is calculated from the
range of the set of equations over the xlim
.
scalar or vector of colors for the lines, recycled as necessary
scalar or vector of line widths for the lines, recycled as necessary
scalar or vector of line types for the lines, recycled as necessary
logical; draw horizontal and vertical axes through (0,0)?
logical, or a vector of character labels for the equations; if TRUE
, each equation is labeled
using the character string resulting from showEqn
, modified so that the
x
s are properly subscripted.
logical; should the solution points for pairs of equations be marked?
Michael Friendly
Fox, J. and Friendly, M. (2016). "Visualizing Simultaneous Linear Equations, Geometric Vectors, and Least-Squares Regression with the matlib Package for R". useR Conference, Stanford, CA, June 27 - June 30, 2016.
# consistent equations
A<- matrix(c(1,2,3, -1, 2, 1),3,2)
b <- c(2,1,3)
showEqn(A, b)
plotEqn(A,b)
# inconsistent equations
b <- c(2,1,6)
showEqn(A, b)
plotEqn(A,b)
Run the code above in your browser using DataLab