Lab 4 · Lecture 4 · Errors and Their Propagation
Error Lab
Measure errors, watch cancellation destroy digits, and fix formulas by rewriting them.
Choose an expression and move x. The red curve is the naive formula, the green curve the rewritten one. The vertical axis is the relative error on a log scale: 1e−16 is perfect, 1e0 means every digit is wrong.
Error of the forward and central difference approximations of f′(x) as the step h changes (log scales). Type your own f(x).
Try this
e⁻²⁰ by series
Try this
Variance
Try this
Q1 Find the absolute, relative and percentage errors if is approximated by .
; ; .
Q2 If and at , find the maximum relative error in .
.
Q3 The sides of a rectangle are cm and cm. Find the area and its maximum error.
cm². cm² (relative 2.08%).
Q4 Distinguish round-off error and truncation error with one example each.
Round-off: from finite digits, e.g. . Truncation: from stopping an infinite process, e.g. ; the neglected terms are the truncation error.
Q5 Evaluate in 4-significant-digit arithmetic, then by a rewritten formula. Compare with the true value .
Naive: , so (20% error). Rewritten: (0.01% error).
Q6 Why does give 0 in double precision for ? Give an accurate formula.
, which rounds to exactly 1.0 (the gap below 1 is ). Use , which gives .