On Wed, 10 Jul 2002, Nicholas Clark wrote: > > Dan Sugalski wrote: > > > > Heh. I never expected to have to dust off my trig skills when I > > > started this. If I need to dig out the calculus books, I think I'll > > > just go run screaming... > > Unless I'm being thick, x² < y² whenever x < y for positive x and y > (ie you don't need to take the square root of the hypotenuse to work out which > hypotenuse is shorter. And all we're actually interested in which one is > shorter, aren't we?)
(Assuming, of course, that |x| and |y| are both >= 1, which is obviously true here since they are integers. (That's the sort of trick they like to put in the SAT math section.)) Assuming x and y are coordinates in a 2-d space, and that both are integers >= 0, why not just use what is affectionately called the "taxicab" metric: x+y? It is just as "valid" and even quicker to compute than the Euclidean metric sqrt(x^2 + y^2). Of course the ordering of which is "closer" is different depending on the metric chosen -- which is partly my point. If the actual result obtained from a calculation would differ in any significant way depending on which metric were used, then it might be a warning sign that there's a higher-level problem at hand. Practically, of course, any metric is fine for the moment -- it can always be changed later if warranted. -- Andy Dougherty [EMAIL PROTECTED] Dept. of Physics Lafayette College, Easton PA 18042