SameTest option pertaining to Union operation in Mathematica.

Joined
Oct 16, 2021
Messages
1
Reaction score
0
The documentation for SameTest given by Mathematica is very sketchy. I simply do no understand how it works. The example given by Mathematica for SameTest shown boils down to:

Union[{-5, 0, 2, 3, 4}, SameTest -> (Mod[#1, 3] == Mod[#2, 3] &)]

which gives

{-5, 0, 2}

Now, Mod[{-5, 0, 2, 3, 4}, 3] gives

{1, 0, 2, 0, 1}

which should show 4 false comparisons. I do not understand how the result in the example was obtained.

Anyhow, could someone tell me in concise terms what SameTest does when the test result is is true and what it does when the test result is false. I would appreciate a step by step trace of the above simple example. Thanks.
 

Members online

No members online now.

Forum statistics

Threads
2,541
Messages
9,888
Members
700
Latest member
fresh_42
Back
Top