(a + ib)^(x + iy) on HP 15C  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: (a + ib)^(x + iy) on HP 15C (/thread139368.html) 
(a + ib)^(x + iy) on HP 15C  Chris Dean  07292008 I have been looking at the complex mode on my Hp 15C and thought I would develop a program to calculate Re: (a + ib)^(x + iy) on HP 15C  George Bailey (Bedford Falls)  07292008 Hi Chris,
your program is performing well. I checked it with the buildin complex x^y function on my HP 15C, see p. 131 of the Owner's Handbook. Edited: 29 July 2008, 3:48 p.m.
Re: (a + ib)^(x + iy) on HP 15C  Chris Dean  07292008 George How did I miss it! Thanks. I bet your program is very compact. It looks as though I may have made a mountain out of a mole hill. Still I enjoyed the chase! Thanks Chris
Edited: 29 July 2008, 4:31 p.m.
Re: (a + ib)^(x + iy) on HP 15C  George Bailey (Bedford Falls)  07302008 Quote: As you now know I don't need a program to do x^y on complex numbers. For those who don't have the manual, the required keystrokes would be:
"1"
The result's real part is in X now. To check the imaginary part, press f (i) and hold (i).
Re: (a + ib)^(x + iy) on HP 15C  Karl Schneider  07302008 Hi, Chris  Writing applications for the HP15C can be surprisingly rewarding, due to its verstile and extensive capabilities (albeit at slow computational speed). One stellar attribute of the HP15C is the full domain and range of its complexnumber functionality. This was pioneering in handheld calculators in 1982, and still is rarely achieved in most of today's models. As George stated, you can simply use its builtin capability to calculate the complexvalued result of raising one complexvalued number to another complexvalued number. Of course, you notice that the HP15C display goes blank for a while during these extensive computations; even the Pioneerseries HP32S/32SII and HP42S (which are 12 times as fast) do not give results instantly for this calculation. If your goal was to perform such a computation outside of complex mode, you should put rectangular<>polar conversions to good use:
So, you can use >P to calculate the logarithm using two reals. Then, after computing the complexvalued product, use >R with magnitude of 1.00 to find the exponential of the imaginaryvalued part, and multiply by the exponential of the realvalued part. I'm fairly sure this is how the calculators do this internally. Several years ago, we noted that early versions of the HP33s did not do rectangular<>polar conversions properly, due to incorrect handling and calculation of angles. I showed that this bug affected the calculation of powers in the complex domain: http://www.hpmuseum.org/cgisys/cgiwrap/hpmuseum/archv014.cgi?read=66246#66246  KS
Edited: 3 Aug 2008, 12:55 a.m. after one or more responses were posted
Re: (a + ib)^(x + iy) on HP 15C  Chris Dean  07302008 Hi Karl Thanks for your response. The mathematical techniques you have listed are exactly what I used apart from R<>P. These techniques can be applied in scientific calculators without a complex mode.
Chris
(a + ib)^(x + iy) on HP11C/34C w/o registers  Karl Schneider  08022008 Chris  The R>P conversion, with its implicit "atan2" function, offers the important advantage of getting the correct quadrant, and handling cases with an xaxis value of zero. Your program, which uses arctangent, will fail for a = 0 (DBZ error) and a < 0 (incorrect quadrant for arctan). Here's a 30line program to compute (a + ib)^(x + iy) on an HP11C or HP34C without using any storage registers. This program is also portable to the HP15C (ensure that flag 8 is clear during execution), but its builtin complexmode capability is faster and more accurate.
(a) Three conversions to polar, two conversions to rectangular, and four uses of roll up (saves three roll downs each time). Radians mode is set, and the full stack is used for input and calculations. Complex multiplication is facilitated by polar mode, but accuracy is slightly compromised (errors in the ninth significant digit for these examples).  KS
Edited: 3 Aug 2008, 3:53 p.m. after one or more responses were posted
Re: (a + ib)^(x + iy) on HP11C/34C w/o registers  Chris Dean  08032008 Karl Thank you very much for the effort.
Chris
Re: (a + ib)^(x + iy) on HP11C/34C w/o registers  Katie Wasserman  08032008 Very nice, I love allstack solutions and you didn't even need LASTx! Katie
Edited: 4 Aug 2008, 10:48 a.m. after one or more responses were posted
Re: (a + ib)^(x + iy) on HP11C/34C w/o registers  Karl Schneider  08032008 Hi, Katie and Chris  Thank you.
Quote: They do help to ensure compatibility between user programs by not using numbered registers. It's good if the the allstack solutions don't entail excessive stack manipulation, which is hard to follow. What made this one possible is complex multiplication by polar mode, which unfortunately cost some accuracy due to all the R<>P convertin'. Rectangularmode multiplication would have required four registers, by my reckoning.
Quote: The last nine lines could have been replaced by
COS for an eversoslight reduction in computation (two internal multiplications by unity). Not relying on LASTx is tidier, because LASTx does not always contain the previous value in x: CHS and CLx (to name several) for good reason do not alter LASTx even as they change the xregister value. Interesting exercise  it also sharpened my mathematical understanding of this particular computation.
 KS Edited: 3 Aug 2008, 9:21 p.m.
