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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

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 Right Arrow Icon
Ask a homework question - tutors are online