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.
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.