Register to reply

Newton Raphson Method on Fortran90

by jhosamelly
Tags: fortran90, method, newton, raphson
Share this thread:
jhosamelly
#1
Dec2-12, 01:00 AM
P: 126
Here's what I need to do:

"Compare the effectiveness of the bisection method and Newton’s method for the
equation x^3−2x−2 = 0 which has a single root between x=−4 and x = 2."


So far I've done

ok. this is working but of course I need to do iteration which I don't know how. Can someone teach me please? I'm trying the Newton-Raphson Method first.

Thanks for the help in advance.


EDITED: Sorry, I posted the wrong pic earlier. Here's the correct one.
Phys.Org News Partner Science news on Phys.org
FIXD tells car drivers via smartphone what is wrong
Team pioneers strategy for creating new materials
Team defines new biodiversity metric
gsal
#2
Dec2-12, 12:34 PM
P: 885
program nr
real:: x, xnew, err

write(*,*) "starting x?:"
read(*,*) x

do
    xnew = x - ( (x**3 - (2*x) - 2) / ( ( 3*(x**2) )-2) )
    err = 100*abs( (xnew-x)/x )
    x = xnew
    write(*,*) "x = ", xnew, "  error = ", err
    if (err < 0.000001) exit
end do

end program nr
jhosamelly
#3
Dec3-12, 06:36 AM
P: 126
thanks :))) Is that the iteration already?

gsal
#4
Dec3-12, 12:49 PM
P: 885
Newton Raphson Method on Fortran90

Yes.

Isn't it? Run it and verify the solution


Register to reply

Related Discussions
Newton-Raphson method Calculus & Beyond Homework 12
Newton–Raphson method - Finite difference method Differential Equations 5
Help with Newton-Raphson Method Engineering, Comp Sci, & Technology Homework 9
Newton-Raphson method Calculus & Beyond Homework 6
Newton-Raphson method for y=1/f(x) General Math 2