# lecture14bw - LECTURE 14 ERRORS Errors Big-O E7, Fall 2008,...

This preview shows pages 1–4. Sign up to view the full content.

LECTURE 14 Errors Big-O E7, Fall 2008, M. Frenklach 1 ERRORS yntax • Syntax • Runtime ogical • Logical 2 ERRORS • Roundoff • Truncation 3 ROUNDOFF ERRORS Machine resolution →ε ε = 2 –52 2×10 –16 1 + ε / 2 == 1 >> 1 + (eps/2)*1.000001 == 1 ans = 0 >> 1 + (eps/2)/1.000001 == 1 ans = 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
DECREASING ROUNDOFF ERRORS 1 ab avoid subtraction of 22 a b = −+ close numbers: start adding with smaller numbers, like … + 0.001 + 0.01 + 0.1 + 1 rather than 1 + 0.1 + 0.01 + 0.001 + … TRUNCATION ERRORS 23 x 1 ! 3! x xx ex =+ + + + " 2! 2 x x x + + 1 2! ≈+ 6 ERROR TOLERANCE computed "exact" some ⎛⎞ answer answer tolerance −≤ ⎜⎟ ⎝⎠ 7 ERRORS Absolute error = pproximate value rue value app o ate a ue tue aue Relative error = bsolute error ue value absolute error/true value 8
BIG-O NOTATION measure of ASYMPTOTIC COMPLEXITY A measure of ASYMPTOTIC COMPLEXITY (N x O(N 0 )=O(1) O(N ) O(N 1 ) O(N 2 ) rder of . . . Order of 9 DEPENDENCE ON SIZE for i = 1:N y(i) = i; nd CPU time = t end Total CPU time = t * N ~ O(N 1 O(N ) 10 DEPENDENCE ON SIZE for i = 1:N for j = 1:N z(i,j) = i; end CPU time = t end Total CPU time = t * N * N O(N

This preview has intentionally blurred sections. Sign up to view the full version.

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

## lecture14bw - LECTURE 14 ERRORS Errors Big-O E7, Fall 2008,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online