Practical "challenge" for the 42S


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?



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....



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.


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...


Possibly Related Threads...
Thread Author Replies Views Last Post
  Another couple of practical speed tests for the 15c Jose Gonzalez Divasson 16 2,926 10-14-2011, 11:39 PM
Last Post: Reth
  42s questions and 42s vs 35s snaggs 13 3,746 09-19-2011, 02:44 AM
Last Post: snaggs
  A new 6-problem challenge (free42 or 42s) Allen 22 3,985 06-12-2011, 05:56 PM
Last Post: Allen
  O.T. want to discuss practical Servos designnut 1 669 03-31-2008, 02:03 PM
Last Post: Richard Ottosen
  35s/42S mini challenge Egan Ford 18 3,020 10-02-2007, 09:15 PM
Last Post: Egan Ford
  RE: 35s sorting routine challenge - Gene's Challenge Miguel Toro 4 1,199 08-01-2007, 08:36 AM
Last Post: Miguel Toro
  A practical application for cube root Karl Schneider 22 3,884 01-30-2007, 09:13 PM
Last Post: Ron
  practical joke William 6 1,298 11-12-2004, 03:55 AM
Last Post: William
  HP-15C (11C/34C/42S/etc) Arguably Useful Mini-Challenge Valentin Albillo 33 4,725 11-25-2003, 05:21 PM
Last Post: hugh

Forum Jump: