Monte Carlo Method
Download
Report
Transcript Monte Carlo Method
MAT 4830
Mathematical Modeling
04
Monte 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 0
Suppose we want to estimate the value of
the integral 1 x
e
0
3
dx
1
Example 0
e
x3
dx
0
Since the function is non-negative over the
interval [0,1], the value of the integral is the
same as the area under the graph
1
e
Example 0
x3
0
We are going to estimate the area by random
numbers.
failure
success
dx
1
e
Example 0
Area
0
number of success
Area of the box
number of trails
failure
success
x3
dx
1
e
Example 0
x3
0
In general, the no. of trials needs to be large.
Area
number of success
Area of the box
number of trails
failure
success
dx
1
e
Example 0
0
failure
success
x3
dx
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 0
What are the disadvantages?
Example 0
What 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!
Classwork
Write a program to estimate the value of
the integral
1
e
0
x3
dx
1
e
Hint:
x3
dx
0
Input n
failure
success
1
e
Hint:
x3
dx
0
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.
failure
success
1
e
Hint:
x3
dx
0
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.
failure
Compute the estimated area.
Output the estimated area.
success
HW Problem 1
Write a program to estimate the value of
the integral
2
5sin
xdx
0
HW Problem 2
Write a program to estimate the value of
the integral
1 1
xy
e
dxdy
0 0
HW Problem 3
Design an experiment using Monte Carlo
Integration to estimate the value of