Function: math[isEqual] - checks whether two arrays are equal

Calling Sequence:

isEqual(A, B);

Parameters:

A, B - two arrays

Description:

isEqual checks whether two vectors or two (m, n)-matrices are equal. (Internally vectors and matrices are represented as arrays .)

If the dimensions of A and B are different, isEqual returns false.

If the dimensions of both A and B are the same but greater than 2, isEqual returns FAIL.

In all other cases A and B, i.e. A and B are vectors or matrices, the structures are compared directly.

If A and B are matrices, each row of A is compared with the corresponding row in B. If they are different, isEqual returns false. If all corresponding rows are equal, isEqual returns true. (Internally linalg[row] is used to extract the rows which are converted to lists to be evaluated by evalb .)

If A and B are vectors, each element of A is compared with the corresponding element in B. If they are different, isEqual returns false. If all corresponding elements are equal, isEqual returns true. (Internally, rather than comparing each element in A and B directly, the vectors are converted to lists which are passed to evalb as an equation.)

This function is part of the math package, and so can be used only after performing the command with(math) or with(math, isEqual).

Examples:

> with(math):

> A := mat(`0 -a 7; a 0 -8; -7 8 0`);

[Maple Math]

> B := copy(A);

[Maple Math]

> isEqual(A, B);

[Maple Math]

> vec1 := V(1, 2, 3);

[Maple Math]

> vec2 := V(1, 2, 3);

[Maple Math]

> isEqual(vec1, vec2);

[Maple Math]

> vec3 := V(0, 0, 0);

[Maple Math]

> isEqual(vec1, vec3);

[Maple Math]

> isEqual(A, vec1);

[Maple Math]

See Also:

math/isIdentity , math/isDiagonal , math/isSymmetric , math/isAntiSymmetric , math/isQuadratic , linalg/equal .

Version History:

Version 1.0 - March 20, 1998