Numerical Methods HW1
Numerical Methods HW1
Numerical Methods HW1
qxd
3/20/09
11:21 AM
Page 76
76
the sum are much larger than the final result of the sum. Furthermore, unlike the previous
case, the individual terms vary in sign. Thus, in effect we are adding and subtracting large
numbers (each with some small error) and placing great significance on the differences
that is, subtractive cancellation. Thus, we can see that the culprit behind this example of
smearing is, in fact, subtractive cancellation. For such cases it is appropriate to seek some
other computational strategy. For example, one might try to compute y = e10 as y = (e1)10.
Other than such a reformulation, the only general recourse is extended precision.
Inner Products. As should be clear from the last sections, some infinite series are particularly prone to round-off error. Fortunately, the calculation of series is not one of the more
common operations in numerical methods. A far more ubiquitous manipulation is the
calculation of inner products, as in
n
xi yi = x1 y1 + x2 y2 + + xn yn
i=1
This operation is very common, particularly in the solution of simultaneous linear algebraic equations. Such summations are prone to round-off error. Consequently, it is often
desirable to compute such summations in extended precision.
Although the foregoing sections should provide rules of thumb to mitigate round-off
error, they do not provide a direct means beyond trial and error to actually determine the
effect of such errors on a computation. In Chap. 4, we will introduce the Taylor series,
which will provide a mathematical approach for estimating these effects.
PROBLEMS
3.1 Convert the following base-2 numbers to base-10: (a) 1011001,
(b) 110.00101 and (c) 0.01011
3.2 Convert the following base-8 numbers to base 10: 71,563 and
3.14.
3.3 Compose your own program based on Fig. 3.11 and use it to
determine your computers machine epsilon.
3.4 In a fashion similar to that in Fig. 3.11, write a short program
to determine the smallest number, xmin , used on the computer you
will be employing along with this book. Note that your computer
will be unable to reliably distinguish between zero and a quantity
that is smaller than this number.
3.5 The infinite series
n
1
f (n) =
4
i
i=1
converges on a value of f (n) = /90 as n approaches infinity.
Write a program in single precision to calculate f (n) for
n = 10,000 by computing the sum from i = 1 to 10,000. Then
repeat the calculation but in reverse orderthat is, from
i = 10,000 to 1 using increments of 1. In each case, compute the
true percent relative error. Explain the results.
4
x2
x3
+
2
3!
and
ex =
1
=
ex
1
x2
x3
1+x +
+
+
2
3!
and compare with the true value of 6.737947 103 . Use 20 terms
to evaluate each series and compute true and approximate relative
errors as terms are added.
3.7 The derivative of f(x) = 1/(1 3x 2 ) is given by
6x
(1 3x 2 )2
Do you expect to have difficulties evaluating this function at
x = 0.577? Try it using 3- and 4-digit arithmetic with chopping.
3.8 (a) Evaluate the polynomial
y = x 3 7x 2 + 8x 0.35
cha01064_ch04.qxd
3/20/09
11:46 AM
Page 105
PROBLEMS
105
PROBLEMS
cos x = 1
x4
x6
x8
x2
+
+
2
4!
6!
8!
x3
x5
x7
+
+
3!
5!
7!
H = Ae T 4
where H is in watts, A = the surface area (m 2 ), e = the emissivity
that characterizes the emitting properties of the surface (dimensionless), = a universal constant called the Stefan-Boltzmann
constant (= 5.67 108 W m2 K4 ), and T = absolute temperature (K). Determine the error of H for a steel plate with A =
0.15 m2 , e = 0.90, and T = 650 20. Compare your results with
the exact error. Repeat the computation but with T = 650 40.
Interpret your results.
4.9 Repeat Prob. 4.8 but for a copper sphere with
radius = 0.15 0.01 m, e = 0.90 0.05, and T = 550 20.
4.10 Recall that the velocity of the falling parachutist can be computed by [Eq. (1.10)],
v(t) =
gm
1 e(c/m)t
c
1 (B H )5/3
S
n (B + 2H )2/3