LinearAlgebra
GenerateMatrix
generate the coefficient Matrix from equations
Calling Sequence
Parameters
Description
Examples
GenerateMatrix(eqns, vars, aug, options)
eqns
-
list or set of (linear) equations or expressions
vars
list or set of variables in which the equations occur
aug
(optional) equation of the form augmented=true or false; specifies how result is returned
options
(optional); constructor options for the result object
The GenerateMatrix(eqns, vars) function generates the coefficient Matrix and right-hand-side Vector from the system of equations or expressions eqns in the unknowns vars. Any of the expressions in eqns that are not equations are treated as equations having right-hand side equal to 0.
Each equation or expression in eqns is split into the part that is homogeneous (degree 1) in the specified variables (vars) and the non-homogeneous part. The coefficient Matrix is constructed from the homogeneous part. The non-homogeneous part is placed in the right-hand-side Vector, or last column of the coefficient Matrix if the augmented form is requested.
The augmented option (aug) determines whether the result is returned as a Matrix-Vector pair or as an augmented system. If given as augmented or augmented=true, the right hand sides of the equations are returned as the last column of the result Matrix. If given as augmented=false or if this option is not included in the calling sequence, then the returned Matrix is the coefficient Matrix and the returned Vector is the right-hand side non-homogeneous part of the linear system.
In the non-augmented case, if the original variables in vars are substituted as the corresponding entries of a Vector x, then the original linear system is equivalent to the Matrix equation:
A . x = b
where A is the coefficient Matrix and b is the right-hand-side Vector.
The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list. If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
This function is part of the LinearAlgebra package, and so it can be used in the form GenerateMatrix(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[GenerateMatrix](..).
with⁡LinearAlgebra:
sys≔3⁢x1+2⁢x2+3⁢x3−2⁢x4=1,x1+x2+x3=3,x1+2⁢x2+x3−x4:
var≔x1,x2,x3,x4:
A,b≔GenerateMatrix⁡sys,var
A,b≔323−21110121−1,130
A·Vector⁡var=b
3⁢x1+2⁢x2+3⁢x3−2⁢x4x1+x2+x3x1+2⁢x2+x3−x4=130
M≔GenerateMatrix⁡sys,var,augmented=true
M≔323−2111103121−10
LinearSolve⁡M
73−_t323_t3113
eqns≔18⁢x⁡t−2⁢y⁡t=diff⁡x⁡t,t,12⁢x⁡t+7⁢y⁡t=diff⁡y⁡t,t
eqns≔18⁢x⁡t−2⁢y⁡t=ⅆⅆtx⁡t,12⁢x⁡t+7⁢y⁡t=ⅆⅆty⁡t
GenerateMatrix⁡eqns,x⁡t,y⁡t
18−2127,ⅆⅆtx⁡tⅆⅆty⁡t
See Also
LinearAlgebra[GenerateEquations]
LinearAlgebra[LinearSolve]
Matrix
Vector
Download Help Document