mat 4830 mathematical modeling 04 monte carlo integrations
DESCRIPTION
Example 0 Suppose we want to estimate the value of the integralTRANSCRIPT
MAT 4830Mathematical Modeling
04Monte Carlo Integrations
http://myhome.spu.edu/lauw
Preview Look at how to use random numbers to
evaluate some integrals First application of Monte Carlo Methods Keep in mind that there are “better”
numerical methods to evaluate integrals No programs will be provided for the
example below
Example 0Suppose we want to estimate the value of the integral 3
1
0
xe dx
Example 0Since the function is non-negative over the interval [0,1], the value of the integral is the same as the area under the graph
31
0
xe dx
Example 0We are going to estimate the area by random numbers.
31
0
xe dx
failure
success
Example 03
1
0
xe dx
failure
number of success Area of the boxnumber of trails
Area
success
Example 0In general, the no. of trials needs to be large.
31
0
xe dx
failure
number of success Area of the boxnumber of trails
Area
success
Example 03
1
0
xe dx
success
failure
Maple Commands
Activate random number generator for various probability distributions.
Can be used before the program (as shown) or within the program.
Maple Commands
Generate random numbers for uniform distributions.
Example 0What are the disadvantages?
Example 0What are the disadvantages? 1.2.3.4.
Monte Carlo Methods Statistical simulation methods Method that utilizes sequences of
random numbers to perform the simulations
Classwork Individual* (Each of you need to think
through the process) Absolutely no communications. Fact: some of you will be faster than
some of the other which is normal!
ClassworkWrite a program to estimate the value of the integral
31
0
xe dx
Hint:3
1
0
xe dx
failure
success
Input n
Hint:3
1
0
xe dx
failure
success
Input n
Repeat the following n times. 1. Generate a random point (x,y) inside the box. 2. Decide if the point is under the graph. Keep track of the number of success.
Hint:3
1
0
xe dx
failure
success
Input n
Repeat the following n times. 1. Generate a random point (x,y) inside the box. 2. Decide if the point is under the graph. Keep track of the number of success.
Compute the estimated area.
Output the estimated area.
HW Problem 1Write a program to estimate the value of the integral
2
0
5sin xdx
HW Problem 2Write a program to estimate the value of the integral
1 1
0 0
xye dxdy
HW Problem 3Design an experiment using Monte Carlo Integration to estimate the value of