Fortran Newton Raphson Method on Fortran90

Click For Summary
The discussion focuses on comparing the effectiveness of the bisection method and Newton's method for solving the equation x^3−2x−2 = 0, which has a single root between x = -4 and x = 2. The user is implementing the Newton-Raphson method and seeks guidance on performing iterations. They share a code snippet that outlines their approach, including the calculation of the new x value and the error metric. The user confirms that the code is indeed performing iterations and is encouraged to run the program to verify the solution. The conversation emphasizes the importance of verifying results through execution and understanding the iterative process in numerical methods.
jhosamelly
Messages
125
Reaction score
0
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
jsyq0z.jpg

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.
 
Last edited:
Technology news on Phys.org
Code:
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
 
thanks :))) Is that the iteration already?
 
Yes.

Isn't it? Run it and verify the solution
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K