HP35S: Decomposing a complex number Message #1 Posted by Antonio Maschio (Italy) on 19 Sept 2008, 12:13 p.m.
Well, I don't know if this has already been treated here (I've done some googling, but nothing seems to match), so I present here my way of doing what's in the title for numbers either in the form 'a+ib' or 'rtheta'. Of course, anyone of you may have a better and shorter way, but my scope is not to do some kind of race with anyone, just to help those who face the HP35S faults.
Reading the program by Valentin Albillo about a 35S solver much more powerful than the builtin one (Valentin's one works on real and complex numbers as well and sorry, but I can't find the thread anymore), I grabbed his powerful algorithm to retrieve the real value of any number (either real or complex).
Extending its action, I built these short routines to do the same both for reals and imaginary parts, depending on the chosen algorithm. Basing on this assumption, I guess this should be called "Valentin's way", not just "Antonio's way".
Note: all routines are for RPN Mode and are all independent of the angle settings (RAD/GRAD/DEG).
get Real value

R001 LBL R
R002 ENTER
R003 ARG
R004 COS
R005 x<>y
R006 ABS
R007 *
R008 RTN
get Imaginary value

I001 LBL I
I002 ENTER
I003 ARG
I004 SIN
I005 x<>y
I006 ABS
I007 *
I008 RTN
Test

I performed the following tests, and here's what I got:
2i7 XEQ I > 7
2i7 XEQ R > 2
2i7 XEQ I > 7
2i7 XEQ R > 2
2i7 XEQ I > 7
2i7 XEQ R > 2
2i7 XEQ I > 7
2i7 XEQ R > 2
Usage

To decompose a complex number do:
ENTER XEQ I x<>y XEQ R
to have the Real part on the display
ENTER XEQ R x<>y XEQ I
to have the Imaginary part on the display
Hope this will help someone.
 Antonio
