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

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

View Full Document Right Arrow Icon
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 difference absolute (or symmetric) difference relative (to a) difference relative (to b) difference percent difference (a) significant digits difference “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 first two are absolute comparisons; the rest are relative comparisons. Let’s only use the absolute difference (|a − b|) and the relative difference (|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 difference as comparing numbers in units of 1. Likewise, you can see the relative difference |a − b|/|a| as comparing a and b in a-units: |a − b|/|a| = .23 means |a − b| is 0.23 a’s. Our floating point number system is fundamentally based on the perspective of relative difference. Therefore, we will most often be stating results using relative errors. Remember that for the relative difference that we must somehow specify whether we are giving a-units or b-units. Significant digits difference 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 first nonzero digit of each number, and then (assuming the exponents are equal) counting the number of digits that match until they differ: 123.45 approximates 123.55 to about 3 significant (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