(35S) Complex conjugate, real and imaginary parts
05-05-2017, 08:26 PM (This post was last modified: 06-15-2017 01:16 PM by Gene.)
Post: #1
 stephane Junior Member Posts: 6 Joined: May 2017
(35S) Complex conjugate, real and imaginary parts
Some basic complex functions are missing on the HP35s.
Among them, the conjugate, and the extraction of the real and imaginary parts.

I use the following formulas to fix the issue:

z.z* = |z|²
z+z* = 2.Re(z)
z-z* = 2.i.Im(z)
r.exp(i.theta) = r.cos(theta) + i.r.sin(theta)

Usage:
Before running one of the following programs, a complex value must be in the stack (REGX):
- Conj(x): XEQ N ___________(the +/- key)
- Re(x) and Im(x): XEQ G ____(the key with the complex i)
After XEQ G call, the stack will contain:
Y: Re(x)
X: Im(x)

The programs preserve the variables of the calculator.
The stack is preserved too.
LASTx is set with the right previous value before running the programs. (I use the following tip: ABS followed by CLx)

Code for Conjugate(x)

Code:
 N001 LBL N N002 ABS N003 CLx N004 SQ(ABS(LASTx))/LASTx    CK=53A7 LN=20 N005 RTN CK=B96B LN=35

Code for Re(x) and Im(x)

Code:
 G001 LBL G G002 ABS(REGX)*COS(ARG(REGX+i0))    CK=A195 LN=27 G003 x<>y G004 ABS G005 CLx G006 ABS(LASTx)*SIN(ARG(LASTx+i0))    CK=2C04 LN=29 G007 RTN CK=C010 LN=77
 « Next Oldest | Next Newest »

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