

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Math 151A Homework #3 – due Wednesday 10/25, in class
Show all your work!
Imagine we’ve invented a trinary (base 3) computer, which stores information as trits
(trinary bits) which can take on values 0, 1 or 2. If (as with binary computers) the tri-
nary computer uses 52 trits to hold the mantissa (a.k.a. the trinary fraction), how many
decimal digits of precision can we expect?
Answer:
Each trit can take on three values, so 52 trits take on 3
52 values. And log 10 (
52 ) =
52 · log 10 (3) ≈ 24 .810, so we can expect 24 or 25 digits of precision.
Suppose that f l(y) is a k-digit rounding approximation to y. Show that
∣ ∣ ∣
y − f l(y)
y
−k+ .
[Hint: If dk+1 < 5, then f l(y) = 0.d 1 d 2... dk× 10
n
. If dk+1 ≥ 5, then f l(y) = 0.d 1 d 2... dk× 10
n
10
n−k .]
Answer:
Let y be represented by y = 0.d 1 d 2 d 3... dkdk+1... × 10
n , where 1 ≤ d 1 ≤ 9 and 0 ≤
di ≤ 9. If dk+1 < 5, then f l(y) = 0.d 1 d 2... dk× 10
n and so
∣ ∣ ∣
y − f l(y)
y
0 .d 1 d 2... dkdk+1... × 10
n − 0 .d 1 d 2... dk× 10
n
0 .d 1 d 2 d 3... dkdk+1... × 10 n
0 .dk+1dk+2... × 10
n−k
0 .d 1 d 2... dk+1dk+2... × 10
n
0 .dk+1dk+...
0 .d 1 d 2...
−k
The denominator of the above expression is bounded below by 0.1, since we know that
d 1 ≥ 1. The numerator is bounded above by 0.5, since we have assumed that dk+1 < 5.
So we have ∣ ∣ ∣
y − f l(y)
y
−k
−k+ .
So the error bound holds for dk+1 < 5.
Now if dk+1 ≥ 5, then we round up by adding 1 to the digit dk, which means that
f l(y) = 0.d 1 d 2... dk× 10
n
n−k and thus
∣ ∣ ∣
y − f l(y)
y
0 .d 1 d 2... dkdk+1... × 10
n − 0 .d 1 d 2... dk× 10
n − 10
n−k
0 .d 1 d 2 d 3... dkdk+1... × 10
n
∣ 0 .d k+1dk+2...^ ×^10
n−k − 10
n−k
∣ 0 .d 1 d 2... dk+1dk+2...^ ×^10
n
∣ 0 .d k+1dk+2 · · · −^1
∣ 0 .d 1 d 2... dk+1dk+...^
−k .
Again, the denominator is bounded below by 0.1. The first term of the numerator is
bounded above by 1.0 and below by 0.5, which means the numerator is bounded above
by 0.5. So we have
∣ ∣ ∣
y − f l(y)
y
−k
−k+ .
Therefor, the error bound also holds for dk+1 ≥ 5.
Compute the absolute error and relative error for approximating π by 22/7. How many
significant digits is the approximation good to?
Answer:
The absolute error is |π − 22 / 7 | ≈ 1. 26 × 10
− 3 and the relative error is the absolute
error divided by π, (1. 26 × 10
− 3 )/(π) = 4. 02 × 10
− 4
. The number of significant digits
is the largest integer t for which
Relative Error ≤ 5 × 10
−t .
Since 4. 02 × 10
− 4 ≤ 5 × 10
− 4 but 4. 02 × 10
− 4
5 × 10
− 5 , the approximation is good to
4 significant digits.
a. The number e can be approximated by the sequence
e ≈
n ∑
k=
k!
If n = 4, what is the relative error and number of significant digits in this approximation
of e? How about when n = 8?
Answer:
When n = 4, e ≈
k=
1 k!
1 2
1 6
1 24
= 2.708¯3, which gives a relative
error of ∣ ∣ ∣
e − 2 .708¯ 3
e
− 3
and 3 significant digits.
When n = 8, e ≈
8 k=
1 k!
≈ 2 .718278770, which gives a relative error of
e − 2. 718278770
e
− 6
and 6 significant digits.
b. The number e can also be approximated by
e ≈ n ·
2 πn
n!
) 1 /n
What is the relative error and number of significant digits when n = 4, n = 8, and
n = 20?