|HP42S' "practical challenge + stuff"...|
Message #2 Posted by Vieira, Luiz C. (Brazil) on 20 Jan 2003, 10:44 a.m.,
in response to message #1 by Karl Schneider
About one year before receiving my "diploma" (certificate) as an Electrical Engineer I wrote a program to compute Load Flow running in an HP42S (good old times...). The complex manipulation was extensive and the program dealt with complex numbers a lot. I remember that I had to assemble and disassemble complex numbers many times, and once I thought: "It's not possible to enter four different complex numbers in the HP42S stack as we can do in the HP15C". I tried a few times, but the needing to finish the program was a priority and I do not remember thinking of this again. I still believe it's not possible UNLESS we use a temporary variable OR L-register, that will not keep previous value. The mentioned procedure in the HP15C with CLX and Re<>IM does not change LSTx contents
The other lack in the HP42S is for the RE<>IM, not available. I used this routine:
The CPX? tests if a complex is already in the X-Register. If so, dismantle it. This way, Y and X will contain real and imaginary parts. Swap them (X<>Y) and reassemble the complex number (COMPLEX), now with Real and Imaginary parts swapped. This also cause previous T-value loss, what does not happen in the HP15C. I think that as we have plenty of bytes in the HP42S in relation to the HP15C, there's always space enough to create a single variable and save one stack register... But I'd like to have a two-byte [Re<>Im] in the HP42S instead of the seven-bytes sequence above.
Another weird thing: since the first RPN-based calculators, the "natural" 2-numbers input sequence has always been
Y-value ENTER X-value [function].This applies mostly to rectangular-to-polar conversion and its counterpart, and two-number statistics. Even in some original HP applications, this sequence is disregarded and we see X-value ENTER Y-value [routine]. I'm trying to figure out why did HP implemented the real-to-complex conversion in both HP15C and HP42S with a "reversed-input" sequence? The HP28 and the HP48 series is somewhat different, if we consider operator
[->], that acts uniformly as an operator, so
«-> a b « procedure »» will cause values in in the stack to be used top-to-down , say,
level-2 contents to X (real part of V) or 'a' and
level-1 contents to Y (imaginary part of V) or 'b'.
I do not complain as it is an uniform relation.
But in both HP15C and HP42S we must think that, if we are working with real numbers, we must enter Y then X prior to compute its polar representation, what agrees with RPN "principles" and stack-registers' names. Otherwise, I have to enter X then Y to build (X+iY) number, disagreeing the same principle. It happens the same with polar representation.
Wow! Too much words for a not-so-complicated matter. My daughter says "You were born to be a teacher, indeed!" everytime she asks me a question and I take many minutes of her attention to answer. And she is 11 Y.O....