Iteration of functions: Finding zeros via the Newton-Raphson method
Implementation of the Newton-Raphson method
Implement the Newton-Raphson method in a programming language, i.e., define someting like the following Python function:
def Newton_solve(f, fp, x0, tol=0.001, maxiter=100):
"""
Find a zero of the function f using the Newton-Raphson Method
starting in x0, with tolerance tol (default: 0.001), and
maximum number of iterations equal to maxiter (default: 100).
fp denotes the derivate of f
"""
Make sure that your function returns the number of iterations required in addition to the approximation found.
- Apply the function
Newton_solve
to the polynomial with starting value to approximate the golden ratio in 9 significant digits. How many iterations do you need? - Apply the function
Newton_solve
to polynomial with starting value .
After how many steps did you determine the zero point in 10 significant digits?
Explain what happens when you choose as your starting value. - Apply function
Newton_solve
to polynomial with starting value .
After how many steps did you determine the zero point in 10 significant digits?
What happens when you choose as your starting value?
Unlock full access