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
icon
Related questions
Question

numerical mathematics 

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 f at
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 + h) − f (x)
h
ƒ'(x)≈
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 în 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).
Transcribed Image Text: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 f at 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 + h) − f (x) h ƒ'(x)≈ 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 în 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).
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Advanced Engineering Mathematics
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
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…
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Mathematics For Machine Technology
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,
Basic Technical Mathematics
Basic Technical Mathematics
Advanced Math
ISBN:
9780134437705
Author:
Washington
Publisher:
PEARSON
Topology
Topology
Advanced Math
ISBN:
9780134689517
Author:
Munkres, James R.
Publisher:
Pearson,