Unformatted text preview: n is large enough so that
b0 − a0
To use Maple for this task, we add a new Step 6 to our previous algorithm for the Bisection Method:
Step 6: Stop if
b0 − a0
The modiﬁed loop in Maple is:
[> f := x -> x∧5 + x -1;
[> a := 0;
[> b := 1.0; deﬁne the function
assign the left-hand endpoint of the original interval to a
assign the right-hand endpoint of the original interval to b [> L := b - a;
[> n := 0; L represents the initial length of the interval
n represents the number of Bisections executed [> e := 10∧(-4);
[> while ( L /(2∧n) > e ) do assign a value to the error represented by e
repeat Bisection Method untile error is less than e [> d := (a+b)/2;
[> if ( evalf( f(a)*f(d) ) < 0) then b := d else a := d end if;
[> n := n+1; calculate the midpoint of the interval
check the sign of the midpoint
counts the number of Bisections completed [> end do;
Maple tells us that after n = 14 iterations of the Bisection Method, the approximated value d = 0.7548217772 is within
10−4 of the actual solution c.
OPTIONAL Challenge Exercise: This loop does not return any value of d if the initial interval length b0 − a0 <
desirederror. How would you modify the loop to deal with this issue?
vi Copyrighted by B.A. Forrest ([email protected]) Newton’s Method in Maple We have just seen that the Intermediate Value Theorem (Bisection Method) gives us a simple but eﬀective method for
ﬁnding approximate solutions to equations. Unfortunately, the method of bisection converges slowly. Instead, we now
introduce Newton’s Method, which is also very easy to describe and to program, but is much more eﬃcient as a means of
ﬁnding approximate solutions to equations. 5 Newton’s Method Just as in the Bisection Method, Newton’s Method allows us to solve equations of the type
f (x) = 0
To see how this method works, we begin with the following simple case.
Assume that f (x) = f (a) + m(x − a) with slope m = 0. This means that f (x) is a linear function whose graph passes
through the point (a, f (a)). Suppose we wanted to ﬁnd a point c such that f (c) = 0 (i.e., c is a root of f (x)). In this case,
because the graph of f (x) is a line with non-zero slope, there is no need to estimate c since we can calculat...
View Full Document