33s -- Newton's Method



#6

As my teacher was talking (for a rather long time--I've teaken the class before) about newton's method in calculus I started trying to make a program on my 33s for calculating it step by step. I know the solver does basically the same thing, but it was really driving me nuts that I couldn't get something working.

Does anyone have a working newton's method program on their calcs that I could look at for starting? I haven't done much programming yet on the 33s. Is there a way to evaluate an equation from my list? Or would I have to edit my program for each equation?

TW


#7

Here is a program to calculate with Newton methold.
It is not for 33S but for Ada95 language (like Pascal), maybe it helps.

P.S. I have a 33S too (not that bad) I will try on it too!:)

with Ada.Float_Text_IO, Ada.Numerics.Elementary_Functions, Text_IO, Ada.Integer_Text_IO;
use Ada.Float_Text_IO, Ada.Numerics.Elementary_Functions, Text_IO, Ada.Integer_Text_IO;


procedure Newton is

X1:Float;
N:Integer;


function Funcao (X:Float) return Float is
Y:Float;
begin
--Put here your function
Y:=(abs(X))**2.0 - 5.0 * X + 4.0;
return Y;
end Funcao;


function Derivada (X:Float) return Float is
YLinha,variacao:Float;
begin
Variacao:=abs(X/1000.0); --This gives the precision.
YLinha:=(Funcao(X+Variacao)-Funcao(X))/Variacao;
return Ylinha;
end Derivada;


begin
Put_Line("Enter X1 (not zero)");
Get(X1);
Put_Line("Enter the number of interactions:");
Get(N);

for A in 1..N loop
Put_Line("F(X" & Integer'Image(A) & ") is : ");
Put(Funcao(X1));
New_Line;
Put_Line("F'(X" & Integer'Image(A) & ") is : ");
Put(derivada(X1));
New_Line;
Put_Line("X" & Integer'Image(A+1) & " vale: ");
X1:=X1- (Funcao(X1)/derivada(X1));
Put(X1);
New_Line;
end loop;

end Newton;

#8

Hi!

Here is your program.
Write your function in program F using X as RCL X.
(In the case shown it is x^2-5x+4)
Put the initial value in A memory (STO A)
Then XEQ N, XEQ N, XEQ N!
Have fun!

José Lauro.

P.S. 1000.000 is for the derivative. To create the delta.
P.S.2 Could someone delete my other message? Thank you!

LBL F
RCL X
2
y^x
RCL X
5
x
-
4
+
RTN

LBL D
RCL A
1000000
/
STO V
RCL A
RCL V
+
STO X
XEQ F
STO D
RCL A
STO X
XEQ F
STO –D
RCL V
STO / D
RCL D
RTN


LBL N
RCL A
STO X
XEQ F
STO N
RCL A
STO X
XEQ D
STO / N
RCL A
RCL N
-
STO A
RTN

#9

Tim --

The 33S, as well as the predecessor 32SII and 32S upon which it was based, all include the SOLVE function. Therefore, I doubt that there would be a Newton's Method program in the manuals, because such a capability is already built in.

The programming and letter-variable paradigm is unique to those three models. However, there is an RPN-based Newton's Method program starting on p. 154 of the HP-11C manual.

Also, there are TVM Equation programs in the HP-11C manual (starting on p. 189) and in the HP-41 Finance and Advantage ROM's. These programs include code to iteratively solve for interest rate in terms of the other four variables, since no direct equation can be derived.

The HP-11C manual is on CD #1 of the MoHPC set for purchase.

-- KS


#10

thanks for the program, and the info. It gives me a place to start at so I can see how to start programming this little beast. =)

TW


Possibly Related Threads...
Thread Author Replies Views Last Post
  A fast Bernoulli Number method for the HP Prime Namir 16 772 11-22-2013, 04:46 PM
Last Post: Namir
  A brand new calculator benchmark: "middle square method seed test" Pier Aiello 25 1,007 09-13-2013, 01:58 PM
Last Post: Pier Aiello
  Downhill Simplex Method (Nelder Mead) for WP-34S Marcel Samek 0 124 07-07-2013, 03:05 AM
Last Post: Marcel Samek
  New Quadratic Lagrangian Interpolation Method Namir 2 205 07-20-2012, 04:32 PM
Last Post: Namir
  New variant for the Romberg Integration Method Namir 8 385 04-18-2012, 07:47 AM
Last Post: Nick_S
  question for lyuka and the Ostrowski method - bumped! hugh steers 7 318 08-27-2011, 11:47 AM
Last Post: Namir
  question for lyuka and the Ostrowski method hugh steers 14 486 08-22-2011, 04:40 PM
Last Post: Lyuka
  Lyuka and the Ostrowski method's for Root Seeking Namir 1 137 08-20-2011, 11:03 AM
Last Post: Lyuka
  An Attempt to Challenge the Bisection method for root findin Namir 6 301 08-14-2011, 05:57 PM
Last Post: Paul Dale
  Further to an earlier posting, Method to the madness! Geoff Quickfall 6 259 03-16-2010, 09:38 PM
Last Post: Geoff Quickfall

Forum Jump: