 Matrix - Maple Help

Matrix Definitions for the Matlab Package Calling Sequence function(M, ...) Matlab[function](M, ...) Description

 • A MatlabMatrix is a matrix defined in MATLAB® memory space. In Maple, the matrix is always named as a string, with double quotes. For example, Matlab[inv]("M") computes the inverse of the variable, "M", which is defined in MATLAB®. If a variable M is defined in Maple, it will be unaffected by, and have no effect on the stated call.  The two calls, Matlab[inv](M) and Matlab[inv]("M") are very different.
 • A MapleMatrix is any Maple expression that is equivalent to a matrix. For example Array(1..2,[1,2]) is equivalent to [1,2], or Vector([1,2]). A MapleMatrix can be an rtable (Array, Matrix or Vector), a table, or a constant (numeric or complex numeric or a symbolic constant such as Pi or infinity). All elements of the MapleMatrix must be of type constant.
 • MATLAB® has access to variables defined in its memory space, and Maple has access to variables defined in its memory space.  Variables are not automatically  shared between memory spaces; they must be explicitly set or read.
 • For example, if a user starts Maple and defines a matrix "M" by typing M := Matrix([[1,2],[3,4]]); the memory space looks like this.

 Maple Memory +--------------+ | M            | +--------------+

 If that user then opens a link to MATLAB® and sets a variable, "X", in MATLAB® to the same value as "M" (using the command Matlab[setvar]("X", M);), the memory is as follows.

 Maple Memory          MATLAB® Memory +--------------+      +---------------+ | M            |      | X             | +--------------+      +---------------+

 The variable M is a MapleMatrix, and "X" is a MatlabMatrix. The command Matlab[inv](M) copies the matrix M to MATLAB® memory space, defining a temporary variable result_for_maple in the process. MATLAB® computes the inverse of result_for_maple and sends the result back to Maple.
 The command Matlab[inv]("X") computes the inverse of "X" and sends the result to Maple.
 It is possible to define the name "M" in both Maple and MATLAB®. After the command Matlab[setvar]("M", Pi), the memory spaces would be as follows.

 Maple Memory          MATLAB® Memory +--------------+      +---------------+ | M            |      | X, M          | +--------------+      +---------------+

 Consider the two commands Matlab[det](M), and Matlab[det]("M"). The subtle difference between these commands makes a significant difference in their results. The first command returns the determinant of the 2x2 matrix, M=[[1,2],[3,4]], which is -2. The second command returns the determinant of the 1x1 matrix, "M"=[Pi], which is Pi. Examples

 > $M≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (1)
 > $\mathrm{with}\left(\mathrm{Matlab}\right):$
 > $\mathrm{Matlab}\left[\mathrm{setvar}\right]\left("X",M\right)$
 > $\mathrm{Matlab}\left[\mathrm{setvar}\right]\left("M",\mathrm{\pi }\right)$
 > $\mathrm{Matlab}\left[\mathrm{det}\right]\left(M\right)$

 -2

 > $\mathrm{Matlab}\left[\mathrm{det}\right]\left("M"\right)$

 3.14159