Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now




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
Resource File(s):

Download Icon 5310.sit Updated: Friday, May 18, 2007 at 12:16 PM
Download Icon 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.




Weblog Commenting and Trackback by HaloScan.com