Chapter 8: Formatting Variables, Recoding Variables, and Writing Programs305
8.8 Case Study 2: Monte Carlo Integration to Estimate
an Integral
Another really cool thing to dois estimate integrals using stochastic methods. Thearea
(volume) under a curve (surface) can be estimated from the proportion of points
randomly generated in some space that lie beneath the curve(surface)multiplied by the
area (volume) of thespace. To make this concrete, consider the problem of estimating the
area under a standard normal density function between 0 and 1.645. You probably
already know the answer—you can read the table. But, let’s see how to
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.