In the next example maple is used to demonstrate

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s, this will happen after only a few iterations because, as a rule of thumb, each iteration doubles the number of decimal places of accuracy. Indeed, Newton’s Method is much more efficient than our previous Bisection Method for finding approximate solutions to equations since the Bisection Method requires roughly 4 iterations to improve the accuracy of the estimate by just 1 decimal place. In the next example, Maple is used to demonstrate Newton’s Method. viii Copyrighted by B.A. Forrest (bforrest@sympatico.ca) Newton’s Method in Maple Example [Newton’s Method in Maple]: Use Newton’s Method to find all the roots of the equation f (x) = ln(4 − x2 ) − x. Begin by drawing a graph to find the initial approximation, x1 . Start Maple. Begin a new worksheet by entering the restart: command. [> restart: Step 1: First define f (x) in Maple. [> f := x -> ln(4 - x∧2) - x; Step 2: Determine an estimate for x1 , the first approximation for the solution (root) to f (x) = 0 by plotting f (x) in Maple. [> plot(f(x), x=-10..10); The plot of f (x) indicates that f (x) = 0 has two roots—one positive and one negative. Let’s try to approximate the positive root which we will call c. After studying the graph, it looks like x1 = 1 might be a good guess to approximate c. Let’s check and see if f (1) is close to 0. [> f(1); Maple returns a symbolic answer. What is the numerical (decimal) approximation? [> evalf( f(1) ); Using x1 = 1 gives us f (1) = 0.098612289. Now 0.098612289 is close to 0 so x1 = 1 is a good approximation for c, but we can do better! Newton’s Method shows us how. Step 3: Determine the next approximation x2 . Newton’s Method tells us that the second approximation x2 to f (x) = 0 is given by x2 = x1 − f (x1 ) f (x1 ) Using the right-hand side of this equation, let’s define a function in Maple called Newton that calculuates xn+1 = xn − f (xn ) f (xn ) We do this so we don’t have to keep typing in the equation x - f(x)/D(f)(x);. [> Newton := x -> x - f(x)/D(f)(x); ix Copyrighted by B.A. Forrest (bforrest@sympatico.ca) Newton’s Method in Maple Now using our first approximation of x1 = 1, find the value of the next iteration of Newton’s Method by using Newton. [> Newton(1); Notice that Maple...
View Full Document

Ask a homework question - tutors are online