Re: more question regarding complex operations using complex number on wp34s Message #14 Posted by Dieter on 2 Sept 2012, 9:00 a.m., in response to message #13 by Dieter
I tried a few examples of complex powers on the 34s, and indeed there are cases where the error becomes substantial. Which can be expected since as the exponent grows, so does the error if the real resp. imaginary part should be exactly zero.
For instance try (2 + 2i)^80. The 34s returns 1,329 E36 + 0,341i. The imaginary part should be zero. Then try (2 + 2i)^82. This returns -2,375 + 1,063 E37. Here the real part should be zero. All this seems to be caused by the limited precision of pi and thus the trig functions near pi, so that the error seems to grow proportionally with the (real) exponent.
A first idea for a quick and easy workaround might be this: simply round the real resp. imaginary part to zero if their ratio is beyond something like 1 : 10^36.
Here is a quick and dirty routine for the 34s:
001 LBL'CPW'
002 CPX y^x
003 CPX ENTER
004 /
005 ABS
006 CF 01
007 x>1?
008 SF 01
009 FS? 01
010 1/x
011 SDL 036
012 IP
013 x!=0?
014 SKIP 004
015 FC? 01
016 STO Z
017 FS?C 01
018 STO Y
019 DROP
020 RTN
2 [ENTER] 2 [ENTER] 0 [ENTER] 4 XEQ"CPW" => -64 + 0i
2 [ENTER] 2 [ENTER] 0 [ENTER] 80 XEQ"CPW" => 1,329 E36 + 0i
2 [ENTER] 2 [ENTER] 0 [ENTER] 82 XEQ"CPW" => 0 + 1,603 E37
2 [ENTER] 2 [ENTER] 0 [ENTER] 98 XEQ"CPW" => 0 + 1,784 E44
Maybe someone else (Pauli?) has a better idea? At least for larger exponents the error does not seem to be negligible, so something should be done here.
Dieter
Edited: 2 Sept 2012, 9:01 a.m.
|