February 22, 2011 18.01 Problem Set 3 solutions Part II: 15 points

advertisement
February 22, 2011
18.01 Problem Set 3 solutions
Part II: 15 points
1. This problem is about solving equations like
f (x) = x
for some function f . The idea is that the equation may be too complicated to
solve algebraically, so you look for a numerical approximation.
a) Get a calculator that can calculate cos in radians. Making sure that the calculator
is set for radians, enter .1, then hit the cosine key repeatedly, at least fifteen or
twenty times. Say what you see. (For example, you might say, “the numbers are
getting closer and closer to zero; every time I hit the key, twice as many decimal
places are zero.”)
Again this is a key-punching problem. Here are some of the entries that I got; n is the number
of times I hit the cosine key.
n
display
n
display
n
0
display
.100000000
10
30
1
2
.995004165
.544499396
.73154703
..
.
.73908235
..
.
15
35
3
4
.855386706
.655926664
.74012762
..
.
.73908552
..
.
20
40
5
.792483102
..
.
.73894049
..
.
.73908508
..
.
25
.73910519
45
.73908514
What I would say is that the even-numbered terms (0, 2, 4. . . ) seem to be increasing, and the
odd-numbered terms (1, 3, 5,. . . ) seem to be decreasing. They seem to be getting close together:
the distance between successive terms seems to go down by a factor of about 2/3 each time.
b) Find an approximate solution x0 to the equation cos(x) = x. Say how accurate you
believe your solution is, and why.
What I actually got after hitting cosine 50 and 51 times was
.7390851321858112,
.739085133908542.
Since the even terms are increasing and the odd ones are decreasing, I believe that the limit is
between these two values. So my answer is
.7390851321858112,
error at most .0000000018 ≈ 2 × 10−9 .
c) Repeat part (a) (again starting with .1) this time hitting the sine key repeatedly.
Here is some output.
n
display
n
display
n
display
0
.100000000
10
30
1
2
.099833417
.099667664
.098370743
..
.
.095337974
..
.
15
35
3
4
.099502736
.099338624
.097585459
..
.
.094622667
..
.
20
40
5
.099175323
..
.
.096818707
..
.
.093923241
..
.
25
.096069773
45
.093239117
Roughly speaking, each display is smaller than the preceding one by about .00015; but looking
carefully, you see that the rate of decrease is decreasing. (The decrease on the first key punch is
.000166, and on the last it’s .000135.) So you might hope at least that after a hundred key punches,
the display will decrease at least to .1 − (100)(.0001) = .1 − .01 = .09.
If you’re really insightful numerically, you might be led to guess that if x is positive and small,
then sin x is smaller than x by about x3 /6. (Notice that (.1)3 /6 = .001/6 = .000167.) Therefore,
after approximately 9/x2 key punches, the display should shrink from x to about x/2. (Try this
with x = .5.) Then about 36/x2 key punches (four times as many!) are needed to shrink from x/2
to x/4. Things go slower and slower, but you can get as close to zero as you want.
d) Find an exact solution x0 to the equation sin(x) = x.
From the values you should know of sin and cos, sin(0) = 0; so x = 0 is a solution.
2. This problem aims to understand what you saw in the first problem. Suppose f
is a differentiable function of x, and that there is a solution x0 to the equation
f (x) = x.
a) Suppose x is an approximation to x0 , with an error of (x − x0 ). Using a linear
approximation to f at x0 , find an approximation for f (x) − x0 .
The linear approximation is
f (x) ≈ f (x0 ) + f 0 (x0 )(x − x0 ) = x0 + f 0 (x0 )(x − x0 ).
Therefore
f (x) − x0 ≈ f 0 (x0 )(x − x0 ).
This says that the new error f (x) − x0 is approximately equal to the derivative f 0 (x0 ) times the
old error x − x0 .
b) Under what conditions would you expect that f (x) is a better approximation to x0
than x?
Since the error is multiplied by f 0 (x0 ), it shrinks whenever |f 0 (x0 )| < 1; increases in size
whenever |f 0 (x0 )| > 1; and is more or less the same size whenever |f 0 (x0 )| = 1. A good answer is
when the derivative at x0 is smaller than 1 in absolute value.
c) In the case of the equation cos(x) = x, suppose you start with an approximation x
having an error of about .1. About how many times should you hit the cosine key to
get an approximation with an error of about 10−6 ?
We found in question 1 that the solution x0 is about x0 ≈ .739. The derivative of cos is − sin,
and − sin(x0 ) ≈ −.6736. So the error should (change sign and) decrease by a factor of about .6736
with every keypunch. The question therefore asks: how big should n be so that
(.6736)n (.1) ≈ 10−6 ,
(.6736)n ≈ 10−5 .
Taking log of both sides gives
n log(.6736) ≈ −5,
n ≈ (−5)/ log(.6736) ≈ 30.
So the suggestion is that about thirty punches are required.
Numerical test: starting with x = .64 is an error of about .1. Hitting cos thirty times gives
.7390844, which differs from the exact value of .73908513 . . . by about 7 × 10−7 .
Download