35S Complex Number Extraction - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: 35S Complex Number Extraction (/thread-2264.html) 35S Complex Number Extraction - Eddie W. Shore - 10-10-2014 01:34 AM From my latest blog entry at: http://edspi31415.blogspot.com/2014/10/what-im-doing-and-hp35s-complex-number.html Here are three utilities you may find useful for the HP35S: 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 Polar to Rectangular Conversion: Calculate a+bi, given: * angle (argument) stored in X and, * modulus (absolute value) Y: C001 LBL C C002 RCL X C003 COS C004 RCLx Y C005 RCL X C006 SIN C007 RCLx Y C008 i C009 x C010 + C011 RTN Question: Do you want me to post a link here every time I update my blog? I talk about HP calculators a lot (not always, but a majority of the time). Thank, Eddie RE: 35S Complex Number Extraction - rprosperi - 10-10-2014 02:45 AM (10-10-2014 01:34 AM)Eddie W. Shore Wrote:  From my latest blog entry at: http://edspi31415.blogspot.com/2014/10/what-im-doing-and-hp35s-complex-number.html Question: Do you want me to post a link here every time I update my blog? I talk about HP calculators a lot (not always, but a majority of the time). Thank, Eddie I say yes please Eddie! Your blog is always interesting, educational and fun. HP or not, please do post them! RE: 35S Complex Number Extraction - Joe Horn - 10-10-2014 03:20 AM (10-10-2014 02:45 AM)rprosperi Wrote:   (10-10-2014 01:34 AM)Eddie W. Shore Wrote:  Question: Do you want me to post a link here every time I update my blog? I say yes please Eddie! Your blog is always interesting, educational and fun. HP or not, please do post them! 1 + RE: 35S Complex Number Extraction - Thomas Klemm - 10-10-2014 04:10 AM You could use LAST X: Code: ```A001 LBL A A002 ABS A003 LAST X A004 ARG A005 COS A006 x A007 RTN``` Cheers Thomas RE: 35S Complex Number Extraction - Marcus von Cube - 10-10-2014 06:59 AM (10-10-2014 01:34 AM)Eddie W. Shore Wrote:  Question: Do you want me to post a link here every time I update my blog? I talk about HP calculators a lot (not always, but a majority of the time). Thank, Eddie The easiest way would be to add a signature with the link to your blog to your forum profile. RE: 35S Complex Number Extraction - Dieter - 10-10-2014 07:33 PM (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