x === y
Strictly equal expressions have the same type, so 0===0. and 0===0/1 are false; the three types involved here are ZZ, RR, and QQ.
If x and y are isMutable then they are strictly equal only if they are identical (i.e., at the same address in memory). For details about why strict equality cannot depend on the contents of mutable hash tables, see hashing. On the other hand, if x and y are non-mutable, then they are strictly equal if and only if all their contents are strictly equal.
|
|
For some types, such as ring elements and matrices, strict equality is the same as mathematical equality. This tends to be the case for objects for which not much computation is not required to test equality. For certain other types, such as Ideal or Module, where extensive computations may be required, the operator == implements the desired comparison.
|
|
|
|
|
As it happens, polynomial rings are mutable objects, and new ones are easily created, which are distinct from each other. For example, the rings A and B below are not strictly equal.
|
|