Construct a matrix from equations
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
vars, R>, <Include>)
linalg::expr2Matrix(eqns, vars) constructs
the extended coefficient matrix
of the system
of m linear
eqns with respect to the n indeterminates
vars. The vector
is the right-hand
side of this system.
linalg::expr2Matrix returns the extended
. The right-hand
can be extracted
from the matrix M by
n + 1).
The coefficient matrix A can
be extracted by
(M, n + 1).
Arithmetical expressions in
eqns are considered
as equations with right hand-sides zero.
If no variables are given, then the indeterminates of the equations
are determined with the function
indets and the option
i.e., the left-hand sides of the equations are considered as polynomial
If no component ring
R is given then the
() is chosen as the
component ring of the extended coefficient matrix.
The coefficients of the linear equations are converted into
elements of the component ring
R. An error message
is returned if this is not possible.
The extended coefficient matrix of the system x + y + z = 1, 2 y - z + 5 = 0 of linear equations in the variables x, y, z is the following 2×4 matrix:
delete x, y, z: Ab := linalg::expr2Matrix( [x + y + z = 1, 2*y - z + 5], [x, y, z], Dom::Real )
linalg::matlinsolve to compute the general
solution of this system:
The coefficient matrix or the right-hand side vector can be
be extracted from the matrix
Ab in the following
A := linalg::delCol(Ab, 4); b := linalg::col(Ab, 4)
The following two inputs lead to different linear systems:
delete x, y, z: linalg::expr2Matrix([x + y + z = 1, 2*y - z + 5 = x]), linalg::expr2Matrix([x + y + z = 1, 2*y - z + 5 = x], [x, y])
Note the difference between calling
and without option
delete x, y: linalg::expr2Matrix([x + y = 1, 2*x - y = 3], [x, y])
linalg::expr2Matrix([x + y = 1, 2*x - y = 3], [x, y], Include)
The system of linear equations, i.e. a set or list of expressions
A set or list of indeterminates
A commutative ring, i.e., a domain of category
Appends the negative of the right-hand side vector to the coefficient matrix A of the given system of linear equations. The result is the m×(n + 1) matrix .
1) matrix of the domain