HP35s  Complex Numbers  The Convenient Way

05172016, 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 Rtype, swap XY, change sign (of the complex part) and swap XY back. Alternatively you can do it with converting to Ptype and change the sign of the angle. Example: To demonstrate most features try to calculate (1+i) + conjugate(sqrt(1+1)/_(90/2)) with 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 Rtype 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/Skeypress (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): PRGM TOP 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. Regards deetee 

05172016, 05:29 PM
Post: #2




RE: HP35s  Complex Numbers  The Convenient Way
(05172016 08:08 AM)deetee Wrote: Hi all! This was a subject of much discussion when the 35s was released. I have a set of routines stored on my 35s for just these functions, but I use them so infrequently that I always forget which one is which. (I have a little cheatsheet stored in the case, but who has time find the case and look at that.) I'm glad to see new work in this area, if I get time I may enter your program in my second 35s and give it a try. Thanks for posting. Dave  My mind is going  I can feel it. 

05282016, 11:41 AM
Post: #3




RE: HP35s  Complex Numbers  The Convenient Way
Yeah  that is exactly what I mean:
After half a year "not" calculating with complex numbers you don't know which shortcut does what. So simple menus and a little more convenient programming technique is worth some extra calculating time and some extra bytes of memory (thank god the hp35s has plenty of memory). Regards deetee 

« Next Oldest  Next Newest »

User(s) browsing this thread: