Post Reply 
35S Complex Number Extraction
10-10-2014, 07:33 PM
Post: #6
RE: 35S Complex Number Extraction
(10-10-2014 01:34 AM)Eddie W. Shore Wrote:  Extract the real part of a complex number:
The complex number is on the X stack.

A001 LBL A
A002 ENTER
A003 ABS
A004 x<>y
A005 ARG
A006 COS
A007 x
A008 RTN

Extract the imaginary part of a complex number:
The complex number is on the X stack.

B001 LBL B
B002 ENTER
B003 ABS
B004 x<>y
B005 ARG
B006 SIN
B007 x
B008 RTN

In this case I would prefer an equation. Either stored in the equation list or within a program. Which has the additional advantage of requiring just one stack register. And the original complex number is even preserved in Y.

ABS(REGX)*COS(ARG(REGX))

ABS(REGX)*SIN(ARG(REGX))

But there still is one main problem: the above method is quite straightforward, but its accuracy can be improved. Simply try 1+pi·i – the decomposed results show errors in the last digit:Re=0,999999999997, Im=3,1415926536).

Does someone know of an improved method?

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 35S Complex Number Extraction - Dieter - 10-10-2014 07:33 PM



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