Comments on Homework One

advertisement
Spring 2005
MATH 3001
Comments on Homework One
1. Let f (x) = ex and x0 = 0. Find the n-th taylor polynomial pn (x) for f (x) about x0 . Find a value of n necessary
for pn (x) to approximate f (x) to within 10−6 on [0, 0.5].
Comment: If f (x) = ex , then the Lagrange Form of the Remainder states:
ex − pn (x) =
f n+1 (c)xn+1
,
(n + 1)!
where c is between 0 and x. Hence, the error is bounded by
(0.5)n+1 e0.5 −6
(n + 1)! ≤ 10 .
This inequality first holds for n = 7.
x
2
2
e−t dt gives the probability that any one of series of trails will
2. The error function defined by erf(x) = √
π 0
lie within x units of the mean, assuming the trails have a normal distribution with mean 0 and standard deviation
√
2/2.
Z
2
2
(a) Integrate the maclurin series for e−x to show that erf(x) = √
π
∞
(−1)k x2k+1
.
k=0 (2k + 1)k!
∑
2
2
(b) The error function can also be expressed in the form erf(x) = √ e−x
π
the two series agree for k = 1, 2, and 3.
∞
2k x2k+1
∑ 1 · 3 · 5 · · ·(2k + 1) . Verify that
k=0
(c) Use the series in part (a) to approximate erf(1) to within 10−7 .
(d) Use the same number of terms as in part (c) to approximate erf(1) with the series in part (b).
(e) Explain why difficulties occur using the series in part (b) to approximate erf(x).
Comment: The maclurin series for e
−x2
∞
is
∑ (−1)
k=0
kx
2k
k!
. Hence
Z x
0
∞
∑ (−1)
k=0
kt
2k
k!
!
dt. Hence the series
2 ∞
t 2k+1
expansion for the error function is √ ∑ (−1)k
. Since this is an alternating series, to approximate
(2k + 1)k!
π k=0
2
t 2(n+1)+1
t 2k+1
has at most an absolute error bounded by √
its full sum by the √2π ∑nk=0 (−1)k (2k+1)k!
or
π (2(n + 1) + 1)(n + 1)!
2
t 2n+3
1
2
√
. In particular, to approximate erf(1) to within 10−7 requires √
< 10−7.
π (2n + 3)(n + 1)!
π (2n + 3)(n + 1)!
Hence n = 9. The approximation is .8427007792 while the exact value is .8427007929. The partial sum from
part (b) with the same number of terms yields 0.8427008. Note: there is no useful bound in using the series
from part (b).
3. Use three-digit rounding arithmetic to perform the following calculations. Compare the absolute and relative
errors with the exact value determined to at least five digits. (a) (121 − 0.327) − 119, (b) (121 − 119) − 0.327.
Comment: (a) 2 with absolute error 0.327 and relative error .1955 (b) 1.67 with absolute error 0.003 and relative
error .00179.
4. Suppose two points (x0 , y0 ) and (x1 , y1 ) are on a straight line with y0 6= y1 . Two formulas are available to find
x0 y1 − x 1 y0
(x1 − x0 )y0
the x-intercept of the line: x =
, x = x0 −
.
y1 − y 0
y1 − y 0
2
(a) Show that both formulas are algebraically correct.
(b) Use the data (x0 , y0 ) = (1.31, 3.24) and (x1 , y1 ) = (1.93, 4.76) with three-digit rounding arithmetic to
compute the x-intercept both ways. Which method is better and why?
Comment: The first formula gives −0.00658 while the second −0.0100. The second formula is better since it
postpones subtracting nearly equal quantities until the last computation.
5. Let f (x) = (ex − e−x )/x. (a) Find limx→0 f (x). (b) Use three-digit rounding arithmetic to evaluate f (0.1). (c)
Replace each exponential function with its third degree maclurin polynomial and repeat part (b). (d) The actual
value is f (0.1) = 2.003335000. Find the relative error for the values obtained in parts (a) and (b).
Comment: The limit is 2 since (ex − e−x )/x = [(ex − 1) − (e−x − 1)]/x as x → 2 tends to the derivative evaluated
at x = 0 of ex − e−x which equals 2. In three-digit rounding arithmetic, (ex − e−x )/x = (1.11 − .905)/0.1 = 2.05.
Next we write (ex − e−x )/x as [(1 + x + x2 /2 + x3 /6) − (1 − x + x2 /2 − x3/6))]/x = 2 + x2 /3 in terms of thirddegree maclurin polynomials. Then f (0.1) is approximated as 2.00. The relative error for value 2.05 is .0233
while for 2.00 is .001665.
2
6. Use three-digit chopping arithmetic to compute the sum ∑10
j=1 1/ j first as
1
1
81 + · · · + 1 . Which method is more accurate and why?
1
1
1
+ 41 + · · · + 100
and then by
1
100
+
Comment: For three-digit rounding arithmetic both sums agree and equal 1.55. Using three-digit chopping
arithmetic and adding the terms from largest to smallest, the sum is 1.53 while from smallest to largest 1.54.
7. Find the rate of convergence as h → 0 of (a) limh→0 (1 − cosh)/h = 0, (b) limh→0 (sin h − h cosh)/h = 0.
Comment: (a) Write (1−cosh)/h as (1−[1−h2/2+h4/24−h6/720+O(h8)])/h or (h2 /2−h4/24+h6/720+
O(h8 ))/h which reduces to h − h3/24 + h5/720 + O(h7). Hence the rate of convergence is 1. (b) Write sin(h)
as h − h3/6 + h5/120 − h7/5040 + O(h9) and h cos(h) as h(1 − h2/2 + h4/24 − h6/720 + O(h8)) or h − h3/2 +
h5 /24 − h7/720 + O(h9). Hence, (sin h − h cosh)/h becomes h2 /3 − h4/30 + O(h6). In particular, the rate of
convergence is 2.
8. (a) Suppose 0 < q < p and that αn = α + O(n−p). Show that αn = α + O(n−q ). (b) Make a table listing 1/n,
1/n2, 1/n3, and 1/n4, for n = 5, 10, 100, and 1000. Discuss the varying rates of convergence of these sequences
as n becomes large.
Comment: The answer is in the back of the textbook!
Download