HP Forums
Newton's method - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Newton's method (/thread-13944.html)



Newton's method - hazimrassam - 11-05-2019 09:09 PM

How do I perform Newton's method on my HP prime calculator?


RE: Newton's method - Tim Wessman - 11-06-2019 01:12 AM

Press the HELP button.

Once in the tree, press the "SEARCH" and look for "newton" (check the "find in content" if you want to find any instance of it).

After a bit, you will find a command that I suspect is the one you want... Smile


RE: Newton's method - hazimrassam - 11-06-2019 06:48 AM

The formula is simply Xn-[f(Xn)/f'(Xn)]
Basically I need to plug in different x-values and solve quickly. Is there a way to plug in X values into the same equation without having to rewrite the equation each time I plug in a new x-value?


RE: Newton's method - Tim Wessman - 11-06-2019 01:39 PM

As I gave directions, you will find it. There is a built in command that does exactly what you want.

The goal was to teach about the search capability, the built in help, and make it easier for you to find things next time. Smile


RE: Newton's method - DrD - 11-06-2019 04:14 PM

Try the [Toolbox] key, (then [Help] key, if needed). It's a great resource ...

-Dale-


RE: Newton's method - ThomasA - 11-06-2019 04:38 PM

Hello,
the built in routine 'newton' (you find a complete description following Tim's advice) can be used to study the convergence of the iteration-method (may be that is what you want?) step by step
by looking at the result after only one iteration per function-call:
change to CAS , then
example:
f(x)= x^2-3
wanted: one root of f , estimated value could be 1.3
first input
newton(x^2-3,x,1.3,1)
enter key
output: 1.8038... (this is x_1 in the newton's series)
input
newton(x^2-3,x,Ans,1)
enter key
output: 1.73347958012 (this is x_2)
enter key
output: 1.73347958012 (this is x_3) and so on


hope that helps
Thomas


RE: Newton's method - Wes Loewer - 11-06-2019 04:42 PM

(11-06-2019 06:48 AM)hazimrassam Wrote:  The formula is simply Xn-[f(Xn)/f'(Xn)]
Basically I need to plug in different x-values and solve quickly. Is there a way to plug in X values into the same equation without having to rewrite the equation each time I plug in a new x-value?

Are you wanting just to solve the equation using Newton's Method? If so, then the online help that the others mentioned will give you that info. (Look for the newton() and fsolve() functions.)

However, it sounds like you might be asking how to easily step through Newton's Method so that you can see the intermediate results. If so, what I find helpful with my students is to use the following:

To find the zeros of x^3+x+1, enter an initial guess and then use
X-(X^3+X+1)/(3*X^2+1)|(X=Ans)
and press Enter repeatedly till the result starts to repeat.
[attachment=7794]

You could also use
Ans-(Ans^3+Ans+1)/(3*Ans^2+1)
but that's not as easy to type, nor is it as aesthetically pleasing.


RE: Newton's method - CyberAngel - 11-06-2019 06:29 PM

(11-06-2019 04:42 PM)Wes Loewer Wrote:  
(11-06-2019 06:48 AM)hazimrassam Wrote:  The formula is simply Xn-[f(Xn)/f'(Xn)]
Basically I need to plug in different x-values and solve quickly. Is there a way to plug in X values into the same equation without having to rewrite the equation each time I plug in a new x-value?

Are you wanting just to solve the equation using Newton's Method? If so, then the online help that the others mentioned will give you that info. (Look for the newton() and fsolve() functions.)

However, it sounds like you might be asking how to easily step through Newton's Method so that you can see the intermediate results. If so, what I find helpful with my students is to use the following:

To find the zeros of x^3+x+1, enter an initial guess and then use
X-(X^3+X+1)/(3*X^2+1)|(X=Ans)
and press Enter repeatedly till the result starts to repeat.


You could also use
Ans-(Ans^3+Ans+1)/(3*Ans^2+1)
but that's not as easy to type, nor is it as aesthetically pleasing.

I use RE for computing and adding i to the (complex) x
and store it away - Starting value is an approximate 0. (zero with a dot)
Kind of something like: Settings
(I'm required to give the needed steps for say, five decimals)
Number Format [Fixed]v [5]v
Complex [(a,b) ]v [V]
[HOME] 0. [Sto|>] [ALPHA] [Shift] x
x - (RE(x)^3+RE(x)+1) / (3*RE(x)^2+1) + i [Sto|>] x
[ Enter ] [ Enter ] [ Enter ] [ Enter ] [ Enter ] [ Enter ]
no changes, therefore, the answer is ~ (-0.68233, 5.00000)
5 steps to get -0.68233