nwtmaple

# This time we must calculate x3 x2 f x2 f x2 but

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: returns a symbolic answer. In this case, we are looking for a numerical (decimal) approximation to the solution for f (x) = 0. So we will use Maple’s evalf command. [&gt; evalf( Newton(1) ); Maple tells us that the next approximation for c is x2 = 1.059167373. Let’s see if f (1.059167373) is close to zero? [&gt; f(1.059167373); Indeed, x2 = 1.059167373 is an even better approximation for f (x) = 0 than was x1 = 1. Let’s see if we can do better by doing another iteration of Newton’s Method. This time we must calculate x3 = x2 − f (x2 ) f (x2 ) But we already know that x2 = 1.059167373 and we have Newton, so we don’t have to type this formula in again. [&gt; evalf( Newton(1.059167373) ); Maple tells us that the next approximation for c is x3 = 1.058006881. Let’s see if f (1.058006881) is even closer to zero? [&gt; f(1.058006881); Maple tells us that when x3 = 1.058006881 is used as an approximation for c, we get f (1.058006881) = −0.832 × 10−6 !!! This means that f (1.058006881) = 0.000000832 which is very close to 0! We can stop now as we have just shown that x3 = 1.058006881 is a very good approximation for one solution of f (x) = 0. In real-world applications, the functions that are used are much more complicated and Newton’s Method is a technique that scientists can use to quickly get solutions that have acceptable errors. As we did with the Bisection Method, we can also use Maple’s programming facilities to write a simple routine that contains a loop to calculate the Newton Method iterates. Let’s repeat the previous example using a Maple loop for Newton’s Method. Try entering the following lines in Maple (you do not need to type the comments). Note: As before, Maple will give you the comment Warning, premature end of input until you type in all of the lines. [&gt; f := x -&gt; ln(4 - x∧2) - x; deﬁne the function [&gt; x := 1; initial guess to estimate c [&gt; k := 10; number of times you want to iterate Newton’s Method [&gt; for n from 1 to k do do k iterations of the Newton’s Method [&gt; x := evalf( x - f(x)/D(f)(x) ); calculate the next iterate [&gt; end do; Notice that after the third iteration of Newton’s Method, all of the values are the SAME! This means that three iterations of Newton’s Method gives an es...
View Full Document

## This note was uploaded on 01/09/2013 for the course MATH 127 taught by Professor Prof.smith during the Winter '09 term at Waterloo.

Ask a homework question - tutors are online