Define a function called approximate_newton (f, h, x0, epsilon, maximum iterations), where f is the name of the function whose root you are trying to approximate, h is a small positive stepsize to be used in approximating the derivative of fat the different approximate roots (see approximate formula for f'(x) below), x0 is the initial guess of the root, epsilon is a small positive number used in the stopping condition of the algo- rithm, and maximum_iterations is the maximum number of iterations the method should have. This function should do an approximate version of Newton's method in which the derivative term is replaced by the following approximation to the derivative: f'(x) ≈ ƒ(x + h) − f (x) - h In the argument list of the function, epsilon should be assigned the default value of 0.00001 and maximum_iterations should be assigned the default value of 100. If the maxmimum number of iterations is exceeded, an error message should be printed stating that the method did not converge within the specified maximum number of iterations and the function should return None. The stopping condition for the main loop enacting the algorithm should be: STOP when abs(f(xn)) < epsilon for the first time OR maximum_iterations has been exceeded, where xn is the latest approximation to the root. Ensure that for each iteration of your approximate Newton's method, the following are displayed: the iteration number n; the approximate root xn; and f(xn).
Define a function called approximate_newton (f, h, x0, epsilon, maximum iterations), where f is the name of the function whose root you are trying to approximate, h is a small positive stepsize to be used in approximating the derivative of fat the different approximate roots (see approximate formula for f'(x) below), x0 is the initial guess of the root, epsilon is a small positive number used in the stopping condition of the algo- rithm, and maximum_iterations is the maximum number of iterations the method should have. This function should do an approximate version of Newton's method in which the derivative term is replaced by the following approximation to the derivative: f'(x) ≈ ƒ(x + h) − f (x) - h In the argument list of the function, epsilon should be assigned the default value of 0.00001 and maximum_iterations should be assigned the default value of 100. If the maxmimum number of iterations is exceeded, an error message should be printed stating that the method did not converge within the specified maximum number of iterations and the function should return None. The stopping condition for the main loop enacting the algorithm should be: STOP when abs(f(xn)) < epsilon for the first time OR maximum_iterations has been exceeded, where xn is the latest approximation to the root. Ensure that for each iteration of your approximate Newton's method, the following are displayed: the iteration number n; the approximate root xn; and f(xn).
Advanced Engineering Mathematics
10th Edition
ISBN:9780470458365
Author:Erwin Kreyszig
Publisher:Erwin Kreyszig
Chapter2: Second-order Linear Odes
Section: Chapter Questions
Problem 1RQ
Related questions
Question
numerical mathematics
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
Recommended textbooks for you
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,