The Museum of HP Calculators

HP Forum Archive 10

[ Return to Index | Top of Index ]

Practical "challenge" for the 42S
Message #1 Posted by Karl Schneider on 20 Jan 2003, 2:51 a.m.

All --

I didn't want to compete with Katie Wasserman's challenge regarding implementation of the MOD function on non-equipped RPN calc's ("A New Challenge"), but I'd say that Ed Martin probably nailed it ("A New Challenge - Improved").

Here is a small issue regarding the HP-42S that has puzzled me. Like the 15C, the 42S offers a full 4-element stack for complex numbers. Both machines have similar primary methods of entering complex numbers, basically combining real numbers in the X- and Y-registers into a complex-valued number.

A "challenge" lies in expediently entering a fourth complex number from the keyboard into the X-register without pushing off the contents of the Z-register. This can be done with the 15C -- to enter, e.g., 1+j2, one could do the following:

2 Re<->Im CLx 1

For the 42S, however, I can't figure out how to enter the fourth complex number without pushing the Z-register value off and without using named or numbered storage registers.

Can you?

      
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

Hi;

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:

CPX?
COMPLEX
X<>Y
COMPLEX 

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
[->V2]
and
-> 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....

Cheers.

            
Re: HP42S' "practical challenge + stuff"...
Message #3 Posted by Karl Schneider on 21 Jan 2003, 12:46 a.m.,
in response to message #2 by Vieira, Luiz C. (Brazil)

Luiz --

Thanks for the response. I suspected as much: On the 42S, it's impossible ro enter a new complex number from the keyboard without dumping the contents of the Z-register and without using a named or numbered storage register.

However, I learned something new while researching this: the numbered registers can be dimensioned to store complex-valued entries. Simply recall "REGS", then ENTER, COMPLEX, STO "REGS". Then, any stack contents through the Z-register could be preserved during entry of the complex value a+jb as follows:

RDN, RDN, STO nn, RDN, RDN, (a), ENTER, (b), COMPLEX, RCL nn, RDN.

The lack of a Re<->Im function makes conjugation and other operations more cumbersome and stack-disturbing. It would be nice if "COMPLEX" on the 42S brought up a menu like that of the 28C/S.

                  
Re: HP42S' "practical challenge + stuff"...
Message #4 Posted by Vieira, Luiz C. (Brazil) on 21 Jan 2003, 9:16 a.m.,
in response to message #3 by Karl Schneider

Hi, Karl;

you're right. In the HP42S, "REGS" is a matrix and, differently of the HP15C and the same as the HP28/48/49, matrices in the HP42S may be actualy real or complex. You can create any real-type matrix (NEW) and as it is in the X-register you can repeat the procedure you just mentioned and "convert" it inot a complex matrix. In this particular, I fell "manipulating" complex matrices easier with the HP42 than with the HP15C.

The only limitation I know about data in complex matrices is that either complex or real, any of "REGS" elements will only store six ALPHA characters each, same as the HP41 actual registers.

That's why I guessed a variable, because it is not "attached" to "REGS" numbered structure (you can keep storing and recalling to and from any available numbered register) and may contain real and complex data as well.

Wow! I have simply nobody to talk about this sort of HP, RPN, programming, usage subject except for you guys, at the museum. So, I beg you: forgive-me writing so much. I cannot control myself...

Cheers.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall