Compare

# Compare - Comparing How do we compare two real numbers, say...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Comparing How do we compare two real numbers, say a and b? a − b or b − a |a − b| |a−b| |a| |a−b| |b | |a−b| 100 ∗ |a| − log10 ( |a|−|b| ) a diﬀerence absolute (or symmetric) diﬀerence relative (to a) diﬀerence relative (to b) diﬀerence percent diﬀerence (a) signiﬁcant digits diﬀerence “b is r times a” “b is r percent of a” “b is r percent more than a” “b is r percent less than a” and so on... r= r = 100 ∗ b a b a b r = 100 ∗ ( a − 1) b r = 100 ∗ (1 − a ) The ﬁrst two are absolute comparisons; the rest are relative comparisons. Let’s only use the absolute diﬀerence (|a − b|) and the relative diﬀerence (|a − b|/|a|). If we are thinking of a as an approximation to b we might say that “the absolute error in b is” |a − b|. If a = 0, we might say that “the relative error in b is” |a − b|/|a| or “the relative error in approximating a is” |a − b|/|a|. You can view absolute diﬀerence as comparing numbers in units of 1. Likewise, you can see the relative diﬀerence |a − b|/|a| as comparing a and b in a-units: |a − b|/|a| = .23 means |a − b| is 0.23 a’s. Our ﬂoating point number system is fundamentally based on the perspective of relative diﬀerence. Therefore, we will most often be stating results using relative errors. Remember that for the relative diﬀerence that we must somehow specify whether we are giving a-units or b-units. Signiﬁcant digits diﬀerence is a naturally intuitive comparison for numbers that are relatively close to each other. You can visualize it by placing the decimal point before the ﬁrst nonzero digit of each number, and then (assuming the exponents are equal) counting the number of digits that match until they diﬀer: 123.45 approximates 123.55 to about 3 signiﬁcant (decimal) digits. We can compare vectors and functions, etc. using the ideas of distance or norm. For example, if x is an approximate solution to Ax = b, then the relative error in x might be ˜ ˜ x−x ˜ . x ...
View Full Document

## This note was uploaded on 12/18/2010 for the course PHYS 5073 taught by Professor Mark during the Fall '10 term at Arkansas.

Ask a homework question - tutors are online