Equal - Maple Help

LinearAlgebra

 Equal
 compare two Vectors or two Matrices for equality

 Calling Sequence Equal(A, B, c)

Parameters

 A - Matrix or Vector B - Matrix or Vector c - (optional) equation of the form compare=method where method is one of 'entries', 'structure', or 'all'; type of comparison to make

Description

 • In any call to Equal(..), A and B must be the same type (both Matrices or both Vectors). Otherwise, Equal(..) returns false.
 • The Equal(A, B) function returns true if A and B are the same type, have the same dimension, and have equal component-wise data.  In particular, if A and B are Vectors, they must also have the same orientation.
 Since compare='entries' is the default comparison method, Equal(A, B) and Equal(A, B, compare='entries') are equivalent.
 • For Matrices, the Equal(A, B, compare='structure') function returns true if A and B have the same dimension, datatype, shape, storage, attributes, and order.
 For Vectors, the Equal(A, B, compare='structure') function returns true if A and B have the same dimension, datatype, shape, storage, attributes, and orientation.
 The compare='structure' method does not consider the value of the entries in the Matrices or Vectors in its comparison.
 • The Equal(A, B, compare='all') function is equivalent to the logical AND of compare='entries' and compare='structure'.
 • This function is part of the LinearAlgebra package, and so it can be used in the form Equal(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[Equal](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $R≔\mathrm{Vector}\left[\mathrm{row}\right]\left(\left[\frac{1}{2},\frac{3}{2},-\frac{1}{5},\frac{3}{5}\right],\mathrm{datatype}=\mathrm{rational}\right)$
 ${R}{≔}\left[\begin{array}{cccc}\frac{{1}}{{2}}& \frac{{3}}{{2}}& {-}\frac{{1}}{{5}}& \frac{{3}}{{5}}\end{array}\right]$ (1)
 > $F≔\mathrm{Vector}\left[\mathrm{row}\right]\left(\left[0.5,1.5,-0.2,0.6\right],\mathrm{datatype}=\mathrm{sfloat}\right)$
 ${F}{≔}\left[\begin{array}{cccc}{0.5}& {1.5}& {-0.2}& {0.6}\end{array}\right]$ (2)
 > $\mathrm{Equal}\left(R,F\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{Equal}\left(R,F,\mathrm{compare}=\mathrm{all}\right)$
 ${\mathrm{false}}$ (4)
 > $S≔⟨⟨2,0⟩|⟨0,2⟩⟩$
 ${S}{≔}\left[\begin{array}{cc}{2}& {0}\\ {0}& {2}\end{array}\right]$ (5)
 > $\mathrm{Equal}\left(S,\mathrm{ScalarMatrix}\left(2,2\right),\mathrm{compare}=\mathrm{structure}\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{Equal}\left(S,\mathrm{ScalarMatrix}\left(2,2\right),\mathrm{compare}=\mathrm{entries}\right)$
 ${\mathrm{true}}$ (7)