ElementWiseAnd - Maple Help

MTM

 ElementwiseAnd
 element-wise logical and

 Calling Sequence ElementwiseAnd(M1,M2)

Parameters

 M1 - array or scalar M2 - array or scalar

Description

 • The command ElementwiseAnd(M1,M2) performs an element-wise comparison of M1 and M2.
 • For arrays M1 and M2, the result R is an array where  R[i,j] = 1, if both M1[i,j] and M2[i,j] are non-zero, and R[i,j] = 0 otherwise.
 • For array M1 and scalar M2, the result R is an array where  R[i,j] = 1, if both M1[i,j] and M2 are non-zero, and R[i,j] = 0 otherwise.
 • For scalar M1 and array M2, the result R is an array where  R[i,j] = 1, if both M1 and M2[i,j] are non-zero, and R[i,j] = 0 otherwise.
 • For scalars M1 and M2, the result R = 1, if both M1 and M2 are non-zero, R = 0 otherwise.
 • M1 and M2 must be the same size, or scalars.

Examples

 > $\mathrm{with}\left(\mathrm{MTM}\right):$
 > $\mathrm{M1}≔\mathrm{Matrix}\left(\left[\left[1,0\right],\left[0,4\right]\right]\right):$
 > $\mathrm{M2}≔\mathrm{Matrix}\left(\left[\left[-1,0\right],\left[3,0\right]\right]\right):$
 > $\mathrm{ElementwiseAnd}\left(\mathrm{M1},\mathrm{M2}\right)$
 $\left[\begin{array}{cc}{1}& {0}\\ {0}& {0}\end{array}\right]$ (1)
 > $\mathrm{M1}≔\mathrm{Matrix}\left(\left[\left[1,0\right],\left[0,4\right]\right]\right):$
 > $\mathrm{ElementwiseAnd}\left(\mathrm{M1},3\right)$
 $\left[\begin{array}{cc}{1}& {0}\\ {0}& {1}\end{array}\right]$ (2)