EqualEntries - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : EqualEntries

EqualEntries

compare elements inside two container structures

 Calling Sequence EqualEntries(A,B);

Parameters

 A - container object B - container object

Description

 • The EqualEntries command compares the elements of A with the elements of B.  EqualEntries('A','B') will return true when both A and B are the same kind of structure, have the same number of elements, and contain the same elements in the same order.  Some exceptions apply.
 • When comparing tables, both tables must have the same index/value pairs.  The indices in both tables must be exactly the same.  That is, an index of 1.0 in one table will not compare equally with 1.00 in the other table.  The values at each index are compared using evalb.
 • When comparing rtables, both structures must have the same number of dimensions, and the same bounds in each dimension.  If A and B are Vectors of differing orientation, EqualEntries will return false.  The values at each index are compared using evalb.
 • When comparing lists, EqualEntries is applied recursively on the elements of the lists.  In this way, lists containing other mutable container objects like tables and rtables can be compared in a deeper way than what evalb does.
 • When comparing sets, EqualEntries will verify that each element in set A has an equivalent entry in set B, and vice versa.  This means that sets A and B need not be the same size for EqualEntries to return true.  As one example, the set {1.0,1.00} is considered to have the same entries as {1.000}.
 • Comparison of modules is currently undefined and may change in the future.
 • All other data structures are directly compared using evalb.

Examples

 > $a≔⟨1,2,3⟩$
 ${a}{≔}\left[\begin{array}{c}{1}\\ {2}\\ {3}\end{array}\right]$ (1)
 > $b≔\mathrm{Vector}\left[\mathrm{column}\right]\left(\left[1,2,3\right]\right)$
 ${b}{≔}\left[\begin{array}{c}{1}\\ {2}\\ {3}\end{array}\right]$ (2)
 > $\mathrm{EqualEntries}\left(a,b\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{EqualEntries}\left(\left[1.0,1.00,1.000\right],\left[1.,1.,1.\right]\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{t1}≔\mathrm{table}\left(\left\{\mathrm{color}=\mathrm{red},\mathrm{size}=4\right\}\right)$
 ${\mathrm{t1}}{≔}{table}{}\left(\left[{\mathrm{color}}{=}{\mathrm{red}}{,}{\mathrm{size}}{=}{4}\right]\right)$ (5)
 > $\mathrm{t2}≔\mathrm{table}\left(\left\{\mathrm{color}=\mathrm{red},\mathrm{size}=5\right\}\right)$
 ${\mathrm{t2}}{≔}{table}{}\left(\left[{\mathrm{color}}{=}{\mathrm{red}}{,}{\mathrm{size}}{=}{5}\right]\right)$ (6)
 > $\mathrm{EqualEntries}\left(\mathrm{t1},\mathrm{t2}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{t2}\left[\mathrm{size}\right]≔4$
 ${{\mathrm{t2}}}_{{\mathrm{size}}}{≔}{4}$ (8)
 > $\mathrm{EqualEntries}\left(\mathrm{t1},\mathrm{t2}\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{EqualEntries}\left(\left\{1.00,1.0\right\},\left\{1.\right\}\right)$
 ${\mathrm{true}}$ (10)

Compatibility

 • The EqualEntries command was introduced in Maple 15.