Question: USE MAXIMA This question is based on a numerical method called Newton's method. Newton's method is an algorithm to find the roots (or zeroes) of
This question is based on a numerical method called Newton's method. Newton's method is an algorithm to find the roots (or zeroes) of a real-valued function. Suppose that a differentiable function f:(a,b)R defined on an interval (a,b) is given and we want to find a good approximate solution for the following equation: f(x)=0 First, we start with a random number x0. Then try to obtain a better approximate value for the root of equation (1) with each iteration : xn=xn1f(xn1)f(xn1) where n is a nonegative integer. Here, n is called the iteration number. Define a function called newton which takes four inputs: an initial point x0, a function f, a function Df representing the derivative of f and an iteration number n. The output should be xn calculated by equation (2) for the given n in the input. To avoid division by zero if f(xi) becomes zero the iteration should stop, print a warning that is given in the answer box, and return the last calculated value if there is any. Note that, to stop the iteration we use the command "break". For example, the following example test calculates an approximate value for sqrt(2), i.e. finds a positive approximate solution for x22=0. For example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
