Post Reply 
HP35s - Complex Numbers - The Convenient Way
05-17-2016, 08:08 AM
Post: #1
HP35s - Complex Numbers - The Convenient Way
Hi all!

I have seen many (very intelligent) programs to improve the deficits of the HP35s in handling complex numbers. After trying lots of them I finally ended a "convenient way", which means menu driven, preserving the stack and using equations (instead of stack operations). As you can see in the program listing I am "wasting" six variables (x,y,z,t,a,b) to save the stack, calculate new values and restore the stack as required.

There are 3 types how to represent complex numbers on the HP35s (C, R and P):
Complex notation x+iy or r/_a, rectangular notation x and y (in register X and Y) or polar notation r and angle a (in register X and Y). So six transformations are possible:
C>PR ... complex to polar or complex to rectangular
P>CR ... polar to complex or polar to rectangular
R>CP ... rectangular to complex or rectangular to polar

As the HP35s has 14 digits only to show a menu there is no place to show menu numbers. So I decided to draw a short menu like "C>PR P>CR R>CP" which means that the user has to remember that C>P means menu number 1, C>R means menu number 2, P>C means menu number 3 ... and so on.

Conjugation was not programmed. Instead you can convert a complex number to R-type, swap XY, change sign (of the complex part) and swap XY back. Alternatively you can do it with converting to P-type and change the sign of the angle.

To demonstrate most features try to calculate
(1+i) + conjugate(sqrt(1+1)/_(-90/2))
i ENTER 1 + ... enter first complex number to stack (could be the result of the last operation)
90 +/- 2 / 1 ENTER 1 + SQRT ... enter second complex number to stack
R/S 4 R/S swapXY +/- swapXY ... convert it to R-type and conjugate
R/S 5 R/S ... convert to complex
+ ... add both complex numbers

Note 1:
To simple start complex operations with only one R/S-key-press (instead of XEQ+C+ENTER) I am using a trick of another user of this forum and coded in line 0001 a "GTO C001". That assumes that you should initially reset the program pointer to 0001 (ie with "GTO.."). So any conversion of a complex number can be performed by pressing 3 keys only (R/S, menu_number, R/S):
0001 GTOc001

Note 2:
To enter the "arrow" in the "program menu equation" you can do a "shift_left to inch conversion" and delete every character but the arrow.

Program listing (short way) (346 bytes):
[c001] LBLc STOx Rdown STOy Rdown STOz Rdown STOt CLx SF10 „[eqn] C>PR P>CR R>CP“ CF10 1 x=y? GTOc037 Rdown 2 x=y? GTOc044 Rdown 3 x=y? GTOc053 Rdown 4 x=y? GTOc056 Rdown 5 x=y? GTOc061 Rdown 6 x=y? GTOc068 GTOc001
[c037] RCLx ARG STOb RCLx ABS STOa GTOc048
[c044] ABS(x)*SIN(ARG(x)) STOb ABS(x)*COS(ARG(x)) STOa
[c048] RCLz RCLy RCLb RCLa RTN
[c053] x*COS(y)+i*x*SIN(y) STOa GTOc063
[c056] x*SIN(y) STOb x*COS(y) GTOc072
[c061] x+i*y STOa
[c063] RCLt RCLt RCLz RCLa RTN
[c068] ATAN(y/x) STOb SQRT(x*x+y*y) STOa
[c072] RCLt RCLz RCLb RCLa RTN

I hope this helps some users to improve the performance of their HP35s.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
HP35s - Complex Numbers - The Convenient Way - deetee - 05-17-2016 08:08 AM

User(s) browsing this thread: 1 Guest(s)