HP Forums
WP34S : is this result "zero" enough ? - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: WP34S : is this result "zero" enough ? (/thread-192695.html)



WP34S : is this result "zero" enough ? - Miguel Toro - 09-01-2011

Hola,

I am still playing with the 15c examples and this time it is from the advanced functions handbook, page 78, calculating the nth roots of a complex number. I tried my best to translate the program, so here is my WP34s version:

001 LBL A
002 [cmplx]x[<->]y
003 [cmplx]1/x
004 [cmplx]RCL L
005 [cmplx]R[v]
006 [cmplx]y[^x]
007 [cmplx]STO 02
008 0
009 ENTER[^]
010 3
011 6
012 0
013 [cmplx]R[^]
014 [cmplx]/
015 [cmplx]STO 04
016 0
017 STO K
018 LBL 00
019 [cmplx]RCL 04
020 RCL[times] K
021 1
022 DEG
023 [->]REC
024 [cmplx]RCL[times] 02
025 1
026 STO+ K
027 R[v]
028 STOP
029 GTO 00

to run it, I first set the ssize8, then 0 FILL and then follow the example in the book, using 1^1/100 as the value. Here are the results:

k = 0,  z0  = 1 (check!)
k = 1, z1 = 0.9980+0.0628i (check!)
k = 50, z50 = -1+(1.2815^-38)i (check? 15C result is -1)

So, is this because the different precision between both machines and this is the good result? ... or am I that bad as a programer :-)

Saludos,

Miguel

Edited: 1 Sept 2011, 8:41 p.m.


Re: WP34S : is this result "zero" enough ? - Marcus von Cube, Germany - 09-02-2011

Miguel, you could try the various rounding modes (RM) which affect how the internal high precision numbers are rounded. The e-38 looks very much like a rounding artifact because the internal precision is in this range.

Looking more closely at your code I see you do calculate the inverse of the exponent and later multiply it by k. This may lead to different results then computing k/n.

Edited: 2 Sept 2011, 2:27 a.m.


Re: WP34S : is this result "zero" enough ? - Paul Dale - 09-02-2011

Without having investigated specifically, the 10-38 result you are seeing is around the internal precision used for calculations.

My guess would be a slight rounding issue is present here. Probably in the polar to rectangular conversion.


Still, I'm not really concerned here, the result is close enough to zero for my liking.


- Pauli


Re: WP34S : is this result "zero" enough ? - Miguel Toro - 09-02-2011

I think the rounding issue may come from the y^x. I tried this simple example with (1+i)^2:

   1, ENTER, 1, 0, ENTER, 2, CPX, Y^X = (-7,5998)^-39 + 2i
1, ENTER, 1, CPX, X^2 = 2i

In both cases the 15c and 42s give 2i as the result, either with y^x or x^2.

I tried the RM command (thanks for calling me geek :-))and it did not make any difference.

As you say, it is close enough to zero.

Thanks,

Migue


Re: WP34S : is this result "zero" enough ? - Paul Dale - 09-05-2011

Quote:
you could try the various rounding modes (RM) which affect how the internal high precision numbers are rounded.

The RM modes only change how an internal high precision number is rounded to a sixteen digit register, not how rounding takes place during internal high precision calculations.


- Pauli