You are on page 1of 8

Instructor: Hacker Name:

Course: AME 302


Chapter 2 Homework Set
Computer Arithmetic and Error
Instructions: Problems in this course are classified into three basic components:

Part 1: True-False concept questions.

Part 2: Basic-computational-skills (BCS) questions.

Part 3: Derivation, analysis, and problem-solving questions


This homework is broke into the first two components with the third part showing up in the
project questions. The rules for each component are listed below.
Part 1: There is no partial credit given for true-false problems. You do not need to show any work
for these problems. There are 15 problems worth 60% (4 points each). [online-component].

Part 2: There is no partial credit given for multiple-choice problems. Although there is no partial
credit on this assignment, you must show your work on all of the problems. If you fail to
show work you will receive a zero for the problem even if it is correct.
There are 10 problems worth 40% (4 points each) [online-component].

Part 1: Circle your answers here. Do not detach this sheet from the homework.

1. T F 6. T F 11. T F

2. T F 7. T F 12. T F

3. T F 8. T F 13. T F

4. T F 9. T F 14. T F

5. T F 10. T F 15. T F

Part 2: Circle your answers here. Do not detach this sheet from the homework.
16. a b c d e 21. a b c d e

17. a b c d e 22. a b c d e

18. a b c d e 23. a b c d e

19. a b c d e 24. a b c d e

20. a b c d e 25. a b c d e
AME 302 chapter 2 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 2

Part 1: True-or-False Concept Questions Component

Accuracy vs. precision

Problem 1. True or False: Crudely, precision refers to how closely individual computed
or measured values agree with each other.

Problem 2. True or False: A company makes a special rod to hold an air shock in
place on a truck. The company that makes the interchangeable rods claims that the
rod is 12.37 ± 0.005 cm long. It is known that the company took many samples of the
manufactured rods, and that accurate measurements were taken. The reported number
with the uncertainty is a statement about precision, but not accuracy since the rods were
not actually inserted into the shocks.

Problem 3. True or False: In general, when we solve a problem numerically we can


never measure precision of the numerical solution unless we happen to already know the
answer.

True error versus approximate error

Problem 4. True or False: True error is a measure of accuracy.

Problem 5. True or False: Given an iteration scheme of the form: xn+1 = f (xn )
for n ∈ N0 , the approximate relative percent error at the (n + 1)st step is given by
a = (xn+1 − xn )/xn+1 .
AME 302 chapter 2 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 3

Absolute versus relative error

Problem 6. True or False: An absolute error of order 10−5 always results in a good
approximation.

Problem 7. True or False: The universal gravitational constant G = 6.67408 × 10−11


is often approximated by 2/3 × 10−10 [SI units left off]. Using exact arithmetic to two
significant figures, the absolute relative error is 0.0011.

Machine epsilon

Problem 8. True or False: Let eps denote the machine epsilon in our idealized decimal
machine, which uses chopping instead of rounding in its calculations. If we enter >> 1 +
(3/2)*eps, the output would be 1 + eps.

Roundoff Errors

Problem 9. True or False: The approximation of the transcendental number π by the


rational number 22/7 is an example of a rounding error.

Problem 10. True or False: A common rational approximation of π is xNS = 22/7. To


5 significant figures the absolute error is approximately

22
π− = 0.0012645 = 1.2645 × 10−3 .
7

Three-digit chopping arithmetic and three-digit rounding arithmetic give the same answer
for the absolute error. 1

1
Here the three-digits must be significant figures. Do not count the zero placeholders, since they would
not be present in our “digital machine number” format. That is, we perform our three-significant-digit
rounding/chopping when the machine number is expressed in the form:

fl(x) = σf · (0.d1 d2 · · · dk ) · 10σe ·n with d1 6= 0 and the σ’s representing the ± signs.
AME 302 chapter 2 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 4

Problem 11. True or False: A common rational approximation of π is xNS = 22/7. To


5 significant figures the absolute error is approximately

22
π− = 0.0012645 = 1.2645 × 10−3 .
7

Four-digit chopping arithmetic and Four-digit rounding arithmetic give the same answer
for the absolute error.

Problem 12. True or False: A common rational approximation of π is xNS = 22/7. To


5 significant figures the absolute relative error is approximately

π − 22
7
= .00040250 = 4.0250 × 10−4 .
π
Three-digit chopping arithmetic and three-digit rounding arithmetic give the same answer
for the absolute relative error.

Truncation Errors

Problem 13. True or False: According to our definition of truncation, chopping error
is an example of a truncation error since with chopping you are truncating the number.

Problem 14. True or False: A five term Taylor series approximation to a function f (x)
is an example of a Truncation Error.

Problem 15. True or False: Replacing a derivative by a difference quotient is an


example of a truncation error.
AME 302 chapter 2 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 5

Part 2: Basic Computational Skills Component

Absolute versus relative error

Problem 16. Compute the absolute relative error |xTS − xNS |/|xTS | of xTS = π by xNS =
22/7 (a common rational approximation of π) using exact arithmetic (keep 4 significant
figures);
(a) 0.0004024 (b) 0.0004026
(c) 0.0004125 (d) 0.0004025
(e) None of these

Converting between Bases

Problem 17. Convert the binary number (100101)2 into a decimal.


(a) 27 (b) 31
(c) 37 (d) 41
(e) None of these

Problem 18. Convert the decimal number (100)10 into a binary number.
(a) (1 011 010)2 (b) (1 101 010)2
(c) (1 101 100)2 (d) (1 100 100)2
(e) None of these
AME 302 chapter 2 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 6

Problem 19. Convert the binary number (1101011)2 into hexadecimal (base 16) number.
(a) (7A)16 (b) (6B)16
(c) (6C)16 (d) (6A)16
(e) None of these

Problem 20. Convert the hexadecimal number (ABC123)16 into a decimal number.
(a) 12, 236, 199 (b) 10, 256, 199
(c) 11, 256, 099 (d) 12, 256, 099
(e) None of these

Roundoff Errors

Problem 21 (Roundoff Error: chopping and rounding). .


Suppose xa must approximate the true value xt with a relative error of at most 10−3 .
Using exact arithmetic find the interval in which xa must lie if xt = π. Then round the
answer to three decimal places. The sum of the rounded end points of the interval are
(a) 6.267 (b) 6.276
(c) 6.283 (d) 6.284
(e) None of these
AME 302 chapter 2 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 7

Truncation Errors

Problem 22 (Truncation Error). .


Find the second-degree Taylor polynomial P2 (x) for the function f (x) = ex sin x about
x = 0 (i.e., x0 = 0). Use P2 (x) to get an approximation for the value of f at x = 1/2.
What is the percent relative error, denoted by t , of the approximation?
(Recall: The relative error is defined as the absolute error |f (x) − P2 (x)| divided by
the absolute value of the true (or theoretical) value |f (x)|). To get percent relative error
multiply by 100.
(a) 0% ≤ t < 3% (b) 3% ≤ t < 6%
(c) 6% ≤ t < 9% (d) 9% ≤ t < 12%
(e) None of these

Problem 23 (Truncation Error). .


The number e is sometimes defined by evaluating the Taylor series about x = 0 of the
function ex at x = 1: ∞
X 1
e= .
n=0
n!
Since n factorial grows so fast as a function of n, this can potentially be a good way to
represent e. What is the smallest value of N for which the relative error will be less than
10−3 . That is,
N
1 X 1
e− < 10−3 .
e n=0
n!
Compute the relative error using exact arithmetic.
(a) 2 ≤ N ≤ 4 (b) 5 ≤ N ≤ 7
(c) 8 ≤ N ≤ 10 (d) 11 ≤ N ≤ 13
(e) None of these
AME 302 chapter 2 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 8

Problem 24 (Truncation Error). .


Use the 9th -degree Taylor polynomial expanded about x = 0 and “exact” arithmetic to
compute an approximation to the number e−5 using the two different expansion methods:
9 9
−5
X (−5)n X
n5
n
e ≈ = (−1) (alternating series of “large” no.s)
n=0
n! n=0
n!
1 1
e−5 = 5
= 9 (inverted series of all positive terms in series)
e X 5n

n=0
n!

Consider the statements given in (i) and (ii). Are the statements true or false?
(i) The alternating series has a smaller relative error because there is more cancellation
than there is in the inverted series of all positive terms.
(ii) If we used three digit chopping in the alternating series, then the general trend
should be that the relative error should be reduced compared to the case of using exact
arithmetic.
(a) Statements (i) and (ii) are true (b) (i) is true; (ii) is false
(c) Both statements are false (d) (i) is false; (ii) is true
You must justify your answer to receive any credit on this problem.

Problem 25 (Finite differences). Let xi−1 , xi , xi+1 be three equally spaced points
along the x-axis a distance h apart (xi±1 = xi ± h), and let y = f (x) be a smooth
function. Use a Taylor series expansion of f about xi to approximate the error incurred
when f 0 (x) is replaced by a centered finite difference. That is, find α ∈ R:

f (xi+1 ) − f (xi−1 )
f 0 (xi ) = + O(hα ) (∗) .
2h
The error on the forward and backward differences are O(h). Is the centered difference
better or worse? Assume h  1.
(a) 1/2, worse (b) 1, the same
(c) 2, better (d) 2, worse
(e) None of these

You might also like