Solved ! Message #12 Posted by Valentin Albillo on 10 Dec 2003, 4:47 a.m., in response to message #11 by RMillán
RMillan posted:
"ABS instead of >P? "
Correct! That's the exact intended solution of the puzzle.
Conversion to polar form (>P) changes the complex stack like this:
X: (x, y) >P X: (mod, arg)
where mod = sqrt(x^2+y^2) and arg = arctan(y/x). We're only interested in the "mod" part, which is mathematically equal to the distance between both given data points, but we're not interested in the "arg" part at all, so it would be nice if we would find some way to avoid computing it at all.
This can be done using the ABS function, which returns the "mod" part alone, changing the complex stack like this:
X: (x, y) ABS X: (mod, 0)
and so we get the distance we need but avoid computing the unneeded angle altogether, thus saving a little time. Thus, my original fast 8step solution was this:
01 LBL A
02 I
03 Rdown
04 I
05 Rup
06 
07 ABS
08 RTN
Congratulations for solving it, extensive to all of you who took interest in this minichallenge. The idea was to show how the comprehensive HP15C builtin function set can be used in nonobvious ways to achieve apparently unrelated computations. In this case, the use of complex functions allows a single "" operation to perform (x2x1) and (y2y1) *simultaneously*, and then ABS computes the square root of the sum of their squares without computing the angle. This way you get done a lot of computation using just *two* steps, "" and "ABS". Neat :)
Best regards from V.
