Matlab - Maple Programming Help

Home : Support : Online Help : Mathematics : Numerical Computations : Matlab : Matlab/square

Matlab

 square
 determine whether a MapleMatrix or MatlabMatrix is square

 Calling Sequence square(X)

Parameters

 X - MapleMatrix or MatlabMatrix

Description

 • The square command returns a value of 'true' if X is a square matrix.  All constants are considered to be one-by-one square matrices.
 • A cubic matrix is not square.  A square matrix can have at most two dimensions.
 • Executing the square command returns a value of either 'true' or 'false'.

Examples

Setting a Maple matrix in MATLAB®.

 > $\mathrm{with}\left(\mathrm{Matlab}\right):$
 > $\mathrm{maplematrix_a}≔\mathrm{Matrix}\left(\left[\left[1,2,3\right],\left[3,4,5\right]\right]\right)$
 ${\mathrm{maplematrix_a}}{≔}\left[\begin{array}{rrr}{1}& {2}& {3}\\ {3}& {4}& {5}\end{array}\right]$ (1)
 > $\mathrm{maplematrix_b}≔\mathrm{Matrix}\left(\left[\left[8,7\right],\left[6,3\right],\left[2,1\right]\right]\right)$
 ${\mathrm{maplematrix_b}}{≔}\left[\begin{array}{rr}{8}& {7}\\ {6}& {3}\\ {2}& {1}\end{array}\right]$ (2)

Determine whether these matrices are square.

 > $\mathrm{Matlab}[\mathrm{square}]\left(\mathrm{maplematrix_a}\right)$

 false

 > $\mathrm{Matlab}[\mathrm{square}]\left(\mathrm{maplematrix_b}\right)$

 false

The matrices are set in the MATLAB® session

 > $\mathrm{setvar}\left("matlabmatrix_a",\mathrm{maplematrix_a}\right)$
 > $\mathrm{setvar}\left("matlabmatrix_b",\mathrm{maplematrix_b}\right)$

The product of maplematrix_a*maplematrix_b is computed in MATLAB® and the result is assigned to matlabmatrix_c. Determine whether the new MatlabMatrix is square.

 > $\mathrm{Matlab}[\mathrm{evalM}]\left("matlabmatrix_c=matlabmatrix_a*matlabmatrix_b"\right)$
 > $\mathrm{Matlab}[\mathrm{square}]\left("matlabmatrix_c"\right)$

 true