MATH 149 LABORATORY ASSIGNMENT 6 NEWTON S METHOD In past laboratory assignments we have encountered equations for which there are no general formulas for the solution For example x 1 sin 2x However MAPLE can usually find an approximation of the solution to any number of decimal places using the fsolve command This laboratory investigates one of the several methods MAPLE uses in executing fsolve Newton s Method is a technique for approximating the solutions of an equation of the form f x 0 It is based on the observation that in most cases if we make a fairly good initial guess say x to the zero of a function f then the x intercept of the 1 tangent line to the graph of f at x f x which we call x is a better 1 1 2 estimate of the zero than was x We repeat the process finding the next 1 approximation x3 the x intercept of the tangent to the graph of f at x2 f x2 Repeating this process n times we found in class that the n 1 st approximation is given by xn 1 xn f xn f xn Example 3 x Find all numbers x in the interval 0 1 for which cos 2 2 x 2 3 x x and First we put the equation in the form f x 0 setting f x cos 2 we plot the graph of f in order to see the approximate locations of the zeros of f restart with plots f x x cos 3 Pi x 2 2 3 f x x cos x 2 2 plot f 0 1 In order to estimate the location of the three zeros of f in the interval 0 1 through Newton s Method we begin by defining the function g which will be used to compute the successive approximations g x x f x D f x g x x f x D f x The value of g for any x is g x x 3 x x cos 2 2 3 x 3 x sin 1 3 cos 2 2 Now to obtain the first zero of f in 0 1 we make an initial guess using the graph for reference and obtain each successive approximation by evaluating g at the previous estimate We will want to use decimal representations for all of the approximations and therefore will use evalf From the graph it appears that x1 0 25 is a reasonable first guess x 1 0 25 x1 0 25 For every positive integer n xn 1 g xn Therefore x 2 evalf g x 1 x2 0 2260966036 x 3 evalf g x 2 x3 0 2277515534 x 4 evalf g x 3 x4 0 2277581314 x 5 evalf g x 4 x5 0 2277581315 x 6 evalf g x 5 x6 0 2277581316 x 7 evalf g x 6 x7 0 2277581315 Thus it appears that the first zero of f nine decimal places in the interval 0 1 is 0 227758132 to The for do command allows us to calculate any number of approximations in one step for n from 1 to 8 do x n 1 evalf g x n od x2 0 2260966036 x3 0 2277515534 x4 0 2277581314 x5 0 2277581315 x6 0 2277581316 x7 0 2277581315 x8 0 2277581316 x9 0 2277581315 Even better we can tell MAPLE to calculate approximations until xn and the next approximation xn 1 are equal in a predetermined number of decimal places In this example we specify 15 decimal places NOTE THAT THE NUMBER OF DIGITS IN MAPLE DECIMAL EXPRESSIONS MUST BE RESET TO BE AT LEAST TWO MORE THAN THE DESIRED LEVEL OF ACCURACY Digits 17 Digits 17 Now we can define the commands to be executed k 1 while abs x k 1 x k 10 15 do k k 1 x k 1 evalf g x k od k 2 x3 0 22775155332125591 k 3 x4 0 22775813150313093 k 4 x5 0 22775813160876803 k 5 x6 0 22775813160876803 From the graph it appears that the second zero in the interval 0 1 is approximately 2 3 1 0 5 and in fact it is exactly 0 5 since cos 4 2 To approximate the final zero of f in 0 1 we first make an initial guess by examining the graph of f and then we apply Newton s Method to obtain successive approximations as before Digits 10 Digits 10 plot f 0 1 A reasonable first estimate would appear to be z1 0 75 We will again use a while do command to generate a solution accurate to 8 decimal places z 1 0 75 z1 0 75 z 2 evalf g z 1 z2 0 7739033963 k 1 while abs z k 1 z k 10 8 k k 1 z k 1 evalf g z k od do k 2 z3 0 7722484468 k 3 z4 0 7722418685 k 4 z5 0 7722418681 Thus the third zero rounded to eight decimal places is 0 77224187
View Full Document
Unlocking...