Newton Raphson Method on Fortran90

In summary, the conversation is about 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 person is asking for help with understanding the iteration process for the Newton-Raphson Method and has provided a program for it. The conversation ends with a confirmation that the program is indeed an iteration.
  • #1
jhosamelly
128
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
  • #2
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
 
  • #3
thanks :))) Is that the iteration already?
 
  • #4
Yes.

Isn't it? Run it and verify the solution
 
  • #5


I would suggest that you utilize the resources available to you, such as textbooks or online tutorials, to learn how to implement the iteration process for the Newton-Raphson method. This process involves repeatedly updating the initial guess for the root until a desired level of accuracy is achieved. Once you have implemented this process, you can compare the effectiveness of the bisection method and Newton's method by analyzing the number of iterations required for each method to converge to the root and the accuracy of the root approximation. Additionally, it would be beneficial to also consider the computational complexity and stability of each method. By comparing these factors, you can determine which method is more effective for solving the given equation.
 

What is the Newton Raphson Method on Fortran90?

The Newton Raphson Method is a numerical method used to find the roots of a given function. In Fortran90, it is a built-in function that can be used to solve equations or systems of equations.

How does the Newton Raphson Method work?

The method involves taking an initial guess for the root of the function and then using the derivative of the function to iteratively improve the guess until a desired level of accuracy is achieved. This process is repeated until the root is found.

What are the advantages of using the Newton Raphson Method on Fortran90?

The method is efficient and accurate, especially for functions with well-behaved derivatives. It can also be used to solve systems of equations, making it a versatile tool for scientific and engineering applications.

What are the limitations of the Newton Raphson Method on Fortran90?

The method may fail if the initial guess is too far from the actual root or if the function has multiple roots. It also requires knowledge of the derivative of the function, which may not always be available.

How can I use the Newton Raphson Method on Fortran90 in my code?

To use the method, you need to define the function and its derivative in your code, then call the built-in NR function with the appropriate arguments. You can also specify the desired level of accuracy and maximum number of iterations.

Similar threads

Replies
16
Views
1K
  • General Math
Replies
7
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • General Math
Replies
9
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
3K
  • Programming and Computer Science
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Calculus
Replies
13
Views
1K
Replies
8
Views
2K
Back
Top