matrix - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

matrix

matrix operations and manipulation

Description

 • Important: The matrix command has been deprecated.  Use the superseding command Matrix instead. For additional information on migrating linalg code to the new packages, see LinearAlgebraMigration.
 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.
 • A matrix in Maple is represented as a two dimensional array with row and column indices indexed from 1.
 • Matrices can be input either directly, as a two dimensional array, or using the matrix command in the linear algebra package. For example, array(1..m,1..n)  creates an empty m by n matrix. See array and linalg[matrix] for further details.
 • The i, j^th entry of the matrix A is accessed, and assigned to, using the subscript notation ${A}_{i,j}$. For example, ${A}_{i,j}≔\frac{1}{{B}_{i,j}}$ assigns the i, jth entry of the matrix A to be the inverse of the i, j^th entry of the matrix B.
 • The linalg (linear algebra) package includes many matrix operations. See linalg for further information.
 • The evalm function performs arithmetic on matrices. See evalm for further information.
 • The map function can be used to apply a function to each entry of a matrix. For example, map(simplify, A) simplifies each entry of the matrix A and map(diff, A, x) differentiates each entry of the vector A with respect to x.  See map for further details.
 • The following indexing functions are available for matrix input: antisymmetric, diagonal, identity, sparse, and symmetric. For example, array(1..10,1..10,identity) creates a 10 by 10 identity matrix.
 • The linalg package has a number of special matrices.  For example, bezout, fibonacci, hilbert, jacobian, sylvester, toeplitz, vandermonde etc. See the linalg package for further details.
 • See type/matrix for testing for a matrix. For example, type(A, 'matrix(integer)') tests for a matrix of integers.

Examples

Important: The matrix command has been deprecated.  Use the superseding command Matrix instead.

 > ${\mathrm{linalg}}_{\mathrm{matrix}}\left(2,3,\left[x,y,z,a,b,c\right]\right)$
 $\left[\begin{array}{ccc}{x}& {y}& {z}\\ {a}& {b}& {c}\end{array}\right]$ (1)
 > $\mathrm{array}\left(1..2,1..2,\left[\left[1,2\right],\left[3,4\right]\right]\right)$
 $\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (2)
 > $\mathrm{type}\left(,\mathrm{matrix}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{array}\left(0..1,0..1,\left[\left[a,b\right],\left[c,d\right]\right]\right)$
 ${array}{}\left({0}{..}{1}{,}{0}{..}{1}{,}\left[\left({0}{,}{0}\right){=}{a}{,}\left({0}{,}{1}\right){=}{b}{,}\left({1}{,}{0}\right){=}{c}{,}\left({1}{,}{1}\right){=}{d}\right]\right)$ (4)
 > $\mathrm{type}\left(,\mathrm{matrix}\right)$
 ${\mathrm{false}}$ (5)
 > $A≔{\mathrm{linalg}}_{\mathrm{matrix}}\left(2,2,\left[\mathrm{sin}\left(x\right),{x}^{2}+x+3,{ⅇ}^{x},\mathrm{cos}\left({x}^{2}\right)\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{\mathrm{sin}}{}\left({x}\right)& {{x}}^{{2}}{+}{x}{+}{3}\\ {{ⅇ}}^{{x}}& {\mathrm{cos}}{}\left({{x}}^{{2}}\right)\end{array}\right]$ (6)
 > $\mathrm{map}\left(\mathrm{diff},A,x\right)$
 $\left[\begin{array}{cc}{\mathrm{cos}}{}\left({x}\right)& {2}{}{x}{+}{1}\\ {{ⅇ}}^{{x}}& {-}{2}{}{x}{}{\mathrm{sin}}{}\left({{x}}^{{2}}\right)\end{array}\right]$ (7)

 See Also