A brief review of definite integration

Now, we're going to use some object-oriented programming in Python to set up a class that we can use to evaluate definite integrals of functions using a Monte Carlo method. Let's stop for a moment and talk about what we mean: suppose we have a mathematical function (as in the type you might see in a calculus class) that we call f(x). When we graph this out on the Cartesian plane between points a and b, it may look something like this:

Now, let's review exactly what definite integration means—let's denote the first gray area in this graph as I, the second gray area as II, and the third gray area as III. Notice that the second gray area here is below zero. The definite integral of f here, from a to b, will be the value I - II + III, and we will denote this mathematically as  In general, the definite integral from a to b is just the sum of all of the total "positive" area bounded by the f function and x-axis with y > 0 between a and b, minus all of the "negative" area bounded by the f function and the x-axis with y < 0 between a and b.

There are many ways to calculate or estimate the definite integral of a function between two points. One that you may have seen in a calculus class is to find a closed-form solution: find the anti-derivative of f, F, and calculate F(b) - F(a). In many areas, though, we won't be able to find an exact anti-derivative, and we will have to determine the definite integral numerically. This is exactly the idea behind Monte Carlo integration: we evaluate f at many, many random points between a and b, and then use those to make an estimate of the definite integral.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.210.91