 GenerateMatrix - Maple Help

LinearAlgebra

 GenerateMatrix
 generate the coefficient Matrix from equations Calling Sequence GenerateMatrix(eqns, vars, aug, options) Parameters

 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 Description

 • 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](..). Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $\mathrm{sys}≔\left[3x\left[1\right]+2x\left[2\right]+3x\left[3\right]-2x\left[4\right]=1,x\left[1\right]+x\left[2\right]+x\left[3\right]=3,x\left[1\right]+2x\left[2\right]+x\left[3\right]-x\left[4\right]\right]:$
 > $\mathrm{var}≔\left[x\left[1\right],x\left[2\right],x\left[3\right],x\left[4\right]\right]:$
 > $A,b≔\mathrm{GenerateMatrix}\left(\mathrm{sys},\mathrm{var}\right)$
 ${A}{,}{b}{≔}\left[\begin{array}{cccc}{3}& {2}& {3}& {-2}\\ {1}& {1}& {1}& {0}\\ {1}& {2}& {1}& {-1}\end{array}\right]{,}\left[\begin{array}{c}{1}\\ {3}\\ {0}\end{array}\right]$ (1)
 > $A·\mathrm{Vector}\left(\mathrm{var}\right)=b$
 $\left[\begin{array}{c}{3}{}{{x}}_{{1}}{+}{2}{}{{x}}_{{2}}{+}{3}{}{{x}}_{{3}}{-}{2}{}{{x}}_{{4}}\\ {{x}}_{{1}}{+}{{x}}_{{2}}{+}{{x}}_{{3}}\\ {{x}}_{{1}}{+}{2}{}{{x}}_{{2}}{+}{{x}}_{{3}}{-}{{x}}_{{4}}\end{array}\right]{=}\left[\begin{array}{c}{1}\\ {3}\\ {0}\end{array}\right]$ (2)
 > $M≔\mathrm{GenerateMatrix}\left(\mathrm{sys},\mathrm{var},\mathrm{augmented}=\mathrm{true}\right)$
 ${M}{≔}\left[\begin{array}{ccccc}{3}& {2}& {3}& {-2}& {1}\\ {1}& {1}& {1}& {0}& {3}\\ {1}& {2}& {1}& {-1}& {0}\end{array}\right]$ (3)
 > $\mathrm{LinearSolve}\left(M\right)$
 $\left[\begin{array}{c}\frac{{7}}{{3}}{-}{{\mathrm{_t}}}_{{3}}\\ \frac{{2}}{{3}}\\ {{\mathrm{_t}}}_{{3}}\\ \frac{{11}}{{3}}\end{array}\right]$ (4)
 > $\mathrm{eqns}≔\left[18x\left(t\right)-2y\left(t\right)=\mathrm{diff}\left(x\left(t\right),t\right),12x\left(t\right)+7y\left(t\right)=\mathrm{diff}\left(y\left(t\right),t\right)\right]$
 ${\mathrm{eqns}}{≔}\left[{18}{}{x}{}\left({t}\right){-}{2}{}{y}{}\left({t}\right){=}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right){,}{12}{}{x}{}\left({t}\right){+}{7}{}{y}{}\left({t}\right){=}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right)\right]$ (5)
 > $\mathrm{GenerateMatrix}\left(\mathrm{eqns},\left[x\left(t\right),y\left(t\right)\right]\right)$
 $\left[\begin{array}{cc}{18}& {-2}\\ {12}& {7}\end{array}\right]{,}\left[\begin{array}{c}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right)\\ \frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right)\end{array}\right]$ (6)