12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

integration 129We see that the third-derivative term in Simpson’s rule cancels (much like thecentral-difference method does in differentiation). Equations (6.20) are illuminatingin showing how increasing the sophistication of an integration rule leads to anerror that decreases with a higher inverse power of N, yet is also proportional tohigher derivatives of f. Consequently, for small intervals and functions f(x) withwell-behaved derivatives, Simpson’s rule should converge more rapidly than thetrapezoid rule.To model the error in integration, we assume that after N steps the relative roundofferror is random and of the formɛ ro ≃ √ Nɛ m , (6.21)where ɛ m is the machine precision, ɛ ∼ 10 −7 for single precision and ɛ ∼ 10 −15 fordouble precision (the standard for science). Because most scientific computationsare done with doubles, we will assume double precision. We want to determine anN that minimizes the total error, that is, the sum of the approximation and round-offerrors:ɛ tot ≃ ɛ ro + ɛ approx . (6.22)This occurs, approximately, when the two errors are of equal magnitude, which weapproximate even further by assuming that the two errors are equal:ɛ ro = ɛ approx = E trap,simp. (6.23)fTo continue the search for optimum N for a general function f, we set the scale offunction size and the lengths by assumingf (n)f≃ 1, b− a =1 ⇒ h = 1 N . (6.24)The estimate (6.23), when applied to the trapezoid rule, yields√Nɛm ≃ f (2) (b − a) 3fN 2 = 1N 2 , (6.25)⇒N ≃( ) 2/51 1(ɛ m ) = 2/5 10 −15 =10 6 , (6.26)⇒ ɛ ro ≃ √ Nɛ m =10 −12 . (6.27)The estimate (6.23), when applied to Simpson’s rule, yields√Nɛm = f (4) (b − a) 5fN 4 = 1N 4 , (6.28)−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 129

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!