Newton's Method

advertisement
Newton's Method
1. To solve the equation f(x) = g(x), let h(x) = f(x) - g(x). Finding zeros of h(x) is equivalent to finding
solutions to the equation f(x) = g(x).
2. Guess a first approximation  x0  for a root of the equation h(x). A graph of h(x) may help.
3. Use the first approximation to get a second, the second to get a third, and so on, using the iterative
h x n 
formula: x n1=x n−
where h ' x n ≠0 .
h ' x n 
Using Maxima to apply Newton's method:
1. Figure out function h(x) and h'(x). Define a function N(x) to be equal to x - h(x)/h'(x).
2. Evaluate N(x) at your initial approximation (x0) for a root. N(x) will return the next approximation
(x1). Simply plug this second approximation back into N(x) to get a second approximation, a third, and
so on.
3. Stop when your approximation is good to five decimal places, namely when N(x) doesn't change
from one approximation to the next for the first five decimal places:
Here's an example: Solve x3 = sin(2x). The first thing you want to do is let h(x) = x^3 - sin(2*x).
Then, compute the derivative of h(x) which is h'(x) = 3*x^2 - 2*cos(2*x). Since the newton method
formula is:
h x n
x n1= x n−
h'  x n 
we need to define a function N(x), meaning "Next Approximation given this choice of x" as follows:
N(x):= x - (x^3 - sin(2*x)) / (3*x^2 - 3*cos(2*x))
Notice the := above, meaning "define this function". Here's what it would look like in "maxima":
Maxima
(C1) N(x):= x - (x^3 - sin(2*x)) / (3*x^2 - 3*cos(2*x))
(D1)
x^3 - sin(2 x)
N(x) := x - ---------------3x^2 - 2 cos(2 x)
(In the next step, notice that we use N(2.0) and not N(2) for our initial guess. This allows Maxima to
return the result in decimal form. Otherwise, you'll get your results in fraction form.)
(C2) N(2.0)
(D2)
1.34195434905399
(C3) N(1.34195434905399)
(D3)
1.067553493512869
(C4) N(1.067553493512869)
(D4)
0.98474477546386
(C5) N(0.98474477546386)
(D5)
0.97569336138806
(C6) N(0.97569336138806)
(D6)
0.97558424998511
(C7) N(0.97558424998511)
(D7)
0.97558423415501
Notice, the last two results didn't change in the first seven decimal places. This means we can stop, since we need
the result to be good to at least five places.
For each of the following problems, you choose a value for k.
Try this with three problems: 1. Find two distinct zeros (by using two different initial values x 0 ) of the function:
3
2
f  x = x −8x −2xk , where k is the sum of the number of month and day you were born. For
example, if your birthdate is 12/31/1971, then k = 12 + 31 = 43.
2. Solve the equation of the form: x 2 = k x − 10 sin(x ) where k is a random number from 1 to 8.
3. The function 2 sec  x x has many zeros, one of them is between x = 2 and x = 3. Find any one of the other zeros (hint: look at a graph to get a good starting value!)
Instructions:
Make sure at the end of each printout, you CLEARLY STATE the EQUATION or PROBLEM you were ORIGINALLY solving, how many "iterations" of Newton's method you needed to apply, and what the final result was. For instance, for the first problem, I would state: "In this problem, I was finding a root of x^3 ­ 8x^2 ­2x ­ 34 by using an initial value of x0 = 5.0. The solution to this problem was x = _____ and it took me _____ tries to achieve this result."
On each printout, label your initial guess as x 0 and each successive approximation with
x 1, x 2, x 3, ... and so on. Finally, attach a graph of the function for which you are computing the zeros and clearly mark the zero you computed.
Good luck!
Download