Post Reply 
(11C) X to Power of X Equation
02-20-2018, 08:19 PM (This post was last modified: 02-20-2018 08:20 PM by Dieter.)
Post: #11
RE: (11C) X to Power of X Equation
(02-20-2018 09:28 AM)Gamo Wrote:  When I try X^X=10 with Newton's Method program which I used STO 5, RCL 5, Y^X, 10, - program steps and this work fine.
Then I try X^X=1000 Program keep running with Error 3. So I was thinking about loop count on this problem that might be the cause of the error or not enough memory.

No. Of course the program does not consume more or less memory if it runs the iteration loop 5, 10 or 50 times. I have looked at the program code, and this is what happens:

The program generates two different errors.

Error 4  is displayed if even after 50 loops the iteration has not converged. If really you got an Error 3 and not Error 4 (sure?) this is not what happened here. Technically this error is generated in line 53: if the DSE loop is left after 50 iterations the program tries to jump to LBL 9 – which does not exist.

Error 3  is displayed if the (approximated) derivative in the Newton formula is zero. In this case the Newton method cannot be used as it divides by this value, so this would lead to a division by zero. If you really got an Error 3 this is what must have happened. Both f(x) and f(x+δ) obviously had the same value.

Technically this error is generated in line 37/38: if the mentioned difference is zero, the program tries to access register ,9 – which does not exist (the program has more than 63 lines).

You may track down the problem by inserting a RCL 2 R/S (or PSE) right before the DSE in line 51. This way you see how the iteration converges – or not. Try it and write down the successive approximations. What was the initial guess you started with for Y=1000? Was it 4? 5? Or was it 0?

The Newton merhod for this particular function does not converge very well. It should work if the initial guess is sufficiently close to the solution. But in other cases the iteration will show very slow convergence or will even lead away from the solution, and you get an error. Try it. The program also implements a quite ..."creative" way of determining the value for δ. This causes even more problems here.

That's why I suggest solving a different equation. Instead of X^X = 1000 you better solve X*ln X = ln 1000. Both functions have the same solution, but the latter behaves far more relaxed and its slope changes much more moderately. So you may use this function at LBL C:

[ENTER] [LN] [x] [EEX] 3 [LN] [–]

Try different initial guesses and see what you get.

Finally an important note: you have to (!) initialize the program with [A] each time before you calculate a solution with [B]. The program overwrites the values that are set with [A], so you have to restore them before you start another iteration with [B].

(02-20-2018 09:28 AM)Gamo Wrote:  What I think is that this program need to use repeat same register for each unknown X.

No again. If X occurs several times in the function you may (!) store it somewhere and recall it from there each time an X occurs on the equation. But of course this is not required! You can just as well store X on the stack, for instance like this:

[ENTER] [ENTER] 6 [Y^X] [X<>Y] [–] 1 [–]

For the given example the STO 5 method is only a bit shorter and easier to understand for RPN beginners.
But calculating X^X on a RPN calculator and NOT doing it with a simple [ENTER] [Y^X]... that's almost ...weird. ;-)

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


Messages In This Thread
(11C) X to Power of X Equation - Gamo - 02-15-2018, 12:33 PM
RE: (11C) X to Power of X Equation - Gamo - 02-16-2018, 06:36 AM
RE: (11C) X to Power of X Equation - Gamo - 02-19-2018, 01:00 AM
RE: (11C) X to Power of X Equation - Gamo - 02-20-2018, 01:49 AM
RE: (11C) X to Power of X Equation - Gamo - 02-20-2018, 09:28 AM
RE: (11C) X to Power of X Equation - Dieter - 02-20-2018 08:19 PM
RE: (11C) X to Power of X Equation - Gamo - 02-21-2018, 04:25 AM



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