Integration using Monte Carlo Approximation

Written by Ryan Young ('00) for Math252, Introduction to Mathematical Modeling with Prof.Brown at Trinity College (Hartford, CT)


To find the definite integral of any one variable expression, type the expression into the first box, labeled "expression". Then enter the upper and lower bounds for the expression in the appropriate boxes. The expression should be written with \'x\' as the unknown variable and can use the following basic functions: sin, cos, tan, arcsin, arccos, arctan, log, ln (for natural logarithims ), |n| (for taking the absolute value of n), e, pi, and ^ (for raising powers). Use ^(1/n) for for taking the n-th root.

The "# of calculations" box is for the number of points you want to see plotted on the graph. 1000 calculations are made for every point plotted, so the total number of calculations will be 1000 times the number you enter. The larger the number, the longer the program needs to run and the more accurate the answer.

The values for any fields left blank are:

The time needed for the program to run using all base cases is about 2 minutes and 20 seconds.

Warning!: This program is VERY picky about input values, please input only valid expressions and numbers. Also, make sure to use 'a*b' for multiplication, not (a)(b) or ab as these will cause the program to stop running. If you accidently hit START with bad input values, hit RESET and hope that everything does reset.


MonteCarlo.java was completed on May 6, 1998