linalg(deprecated)/matrix - Maple Help

linalg(deprecated)

 matrix
 create a matrix

 Calling Sequence matrix(L) matrix(m, n) matrix(m, n, L) matrix(m, n, f) matrix(m, n, lv)

Parameters

 L - list of lists or vectors of elements m, n - positive integers (row and column dimensions) f - function used to create the matrix elements lv - list or vector of elements

Description

 • Important: The linalg package has been deprecated. Use the superseding command, LinearAlgebra[Matrix], instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • The matrix function is part of the linalg package. It provides a simplified syntax for creating matrices. A general description of matrices in Maple is available under the heading matrix.
 • The call matrix(m, n, L) creates an m by n matrix where the first row of the matrix is defined by the list/vector L[1], the second row by L[2], and so forth. The call matrix(L) is equivalent to matrix(m, n, L) where $m=\mathrm{nops}\left(L\right)$ and $n=\mathrm{max}\left(\mathrm{seq}\left(\mathrm{nops}\left({L}_{i}\right),i=1..m\right)\right)$ .
 • The call matrix(m, n) creates an m by n matrix with unspecified elements.
 • The call matrix(m, n, f) creates an m by n matrix whose elements are the result of the function f (possibly a constant) acting on the row and column index of the matrix.  Thus, matrix(m, n, f) is equivalent to matrix([[f(1, 1), ..., f(1, n)], ..., [f(m, 1), ..., f(m, n)]]) .
 • The call matrix(m, n, lv) creates an m by n matrix whose elements are read off from lv row by row, where lv is a list or vector of elements of type algebraic.
 • Since matrices are represented as two-dimensional arrays, see array for further details about how to work with matrices.
 • The command with(linalg,matrix) allows the use of the abbreviated form of this command.
 Note:  The online documentation in Maple uses the convention that matrix (lowercase "m") refers to an array-based matrix used by routines in the linalg package, and Matrix (uppercase "M") refers to an rtable-based Matrix used by routines in the LinearAlgebra package. See LA_general for more information about linear algebra computations in Maple.

Examples

Important: The linalg package has been deprecated. Use the superseding command, LinearAlgebra[Matrix], instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $\mathrm{matrix}\left(2,2,\left[5,4,6,3\right]\right)$
 $\left[\begin{array}{cc}{5}& {4}\\ {6}& {3}\end{array}\right]$ (1)
 > $\mathrm{matrix}\left(\left[\left[5,4\right],\left[6,3\right]\right]\right)$
 $\left[\begin{array}{cc}{5}& {4}\\ {6}& {3}\end{array}\right]$ (2)
 > $\mathrm{matrix}\left(2,2,0\right)$
 $\left[\begin{array}{cc}{0}& {0}\\ {0}& {0}\end{array}\right]$ (3)
 > $f≔\left(i,j\right)↦{x}^{i+j-1}:$
 > $A≔\mathrm{matrix}\left(2,2,f\right)$
 ${A}{≔}\left[\begin{array}{cc}{x}& {{x}}^{{2}}\\ {{x}}^{{2}}& {{x}}^{{3}}\end{array}\right]$ (4)
 > $\mathrm{map}\left(\mathrm{diff},A,x\right)$
 $\left[\begin{array}{cc}{1}& {2}{}{x}\\ {2}{}{x}& {3}{}{{x}}^{{2}}\end{array}\right]$ (5)
 > $A≔\mathrm{matrix}\left(2,2,\left[x,y\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{x}& {y}\\ {{\mathrm{?}}}_{{2}{,}{1}}& {{\mathrm{?}}}_{{2}{,}{2}}\end{array}\right]$ (6)
 > $\mathrm{matrix}\left(\left[\mathrm{col}\left(A,1..2\right)\right]\right)$
 $\left[\begin{array}{cc}{x}& {{A}}_{{2}{,}{1}}\\ {y}& {{A}}_{{2}{,}{2}}\end{array}\right]$ (7)