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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

integration 137Figure 6.4 Throwing stones in a pond as a technique for measuring its area. There is a tutorialon this on the CD where you can see the actual “splashes” (the dark spots) used in anintegration.4. For i =1to N, pick (x i ,y i )=(r 2i−1 ,r 2i ).5. If x 2 i + y2 i < 1, let N pond = N pond +1; otherwise let N box = N box +1.6. Use (6.44) to calculate the area, and in this way π.7. Increase N until you get π to three significant figures (we don’t ask much —that’s only slide-rule accuracy).6.5.2 Integration by Mean Value (Math)The standard Monte Carlo technique for integration is based on the mean valuetheorem (presumably familiar from elementary calculus):I =∫ badx f(x)=(b − a)〈f〉. (6.45)The theorem states the obvious if you think of integrals as areas: The value of theintegral of some function f(x) between a and b equals the length of the interval(b − a) times the mean value of the function over that interval 〈f〉 (Figure 6.5). Theintegration algorithm uses Monte Carlo techniques to evaluate the mean in (6.45).With a sequence a ≤ x i ≤ b of N uniform random numbers, we want to determinethe sample mean by sampling the function f(x) at these points:〈f〉≃ 1 NN∑f(x i ). (6.46)i=1−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 137

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

Saved successfully!

Ooh no, something went wrong!