I have some numerical code involving complex numbers representing points on a plane. Some of these are equal but not identical, ie
{Exp[2 Pi I (-1./10)], ..., Exp[2 Pi I (9./10)]}
I want to make (the equivalent of) a dictionary mapping each to its coordinate in the list (because using Position repeatedly would take too long). But both Downvalues and matching rules (with a Dispatch table) match based on the form of the expression rather than its value (and Hash hashes based on the form of the expression as well).
Eg, if
{a == b, a===b}
==> {True, False}
thenf[a] = 1; {f[a], f[b]}
{1, f[b]}
Is there some way to associate the points with their position (with faster than O(n) lookup) based on their value? I feel like there should also be some way to do it using rounding, but I haven't gotten it to work.
Round
(with a second parameter) to quantize your data. $\endgroup$ – Mr.Wizard May 16 '14 at 20:17