Multi-Threaded Monte-Carlo
Calculation of Pi
Introduction
This worksheet calculates the value of Pi via a multi-threaded (and a single-threaded) Monte-Carlo algorithm. Ntotal darts are randomly thrown at a unit square inscribed with a circle, and the number N that land within the circle are counted. The value of Pi is
The fractional speed-up of the multi-threaded version over the single-threaded version is calculated. Typically on a dual core computer, the speedup is about 30%.
This application was created in Maple 13.02, and uses features that may not be available with earlier versions of Maple.
Number of darts
Generate random points in the unit square.
Algorithm
This procedure tallies the number of darts that land within the circle.
Single-Threaded Timing
Multi-Threaded Extension and Timing
Speedup of Multi-Threaded Version over the Single-Threaded Version
Legal Notice: ? Maplesoft, a division of Waterloo Maple Inc. 2009. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities