Integrating with Random Numbers
Issue: 5.3 (March/April 2007)
Author: JC Cruz
Article Description: No description available.
Article Length (in bytes): 28,050
Starting Page Number: 21
RBD Number: 5310
5310.sit Updated: Friday, May 18, 2007 at 12:16 PM
5310.zip Updated: Friday, May 18, 2007 at 12:16 PM
Related Web Link(s):
Known Limitations: None
Excerpt of article text...
Today, we will look into the basic concepts of Monte-Carlo integration. We will learn how to implement this algorithm in REALbasic. We will also learn how to use this algorithm to estimate the value of pi. And, as a special treat, we will take a look at another way of generating a random sequence.
A Brief Overview of Numerical Integration
Some computer models are possible only with the use of numerical integration. This group of algorithms used to compute the definite integral of a given function. As shown in Figure 1, the act of integration measures the region enclosed by the function and its bounds.
Most integration algorithms perform their tasks by subdividing the region beneath the curve. Then, they compute the definite integral by adding up all of the subdivisions.
One such algorithm is the Rectangular Method. It subdivides the region into a series of very narrow rectangles (Figure 2). Another one is the Trapezium Method. This one uses a series of trapezoids to subdivide the same region (Figure 3). Both of them have an accuracy of O(?x^3), where ?x is the size of the subdividing element. The narrower the element, the more accurate the integral result.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.