mat 4830 mathematical modeling 04 monte carlo integrations

21
MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations http://myhome.spu.edu/lauw

Upload: clementine-barber

Post on 18-Jan-2018

219 views

Category:

Documents


0 download

DESCRIPTION

Example 0 Suppose we want to estimate the value of the integral

TRANSCRIPT

Page 1: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

MAT 4830Mathematical Modeling

04Monte Carlo Integrations

http://myhome.spu.edu/lauw

Page 2: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

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

Page 3: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Example 0Suppose we want to estimate the value of the integral 3

1

0

xe dx

Page 4: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

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

Page 5: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Example 0We are going to estimate the area by random numbers.

31

0

xe dx

failure

success

Page 6: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Example 03

1

0

xe dx

failure

number of success Area of the boxnumber of trails

Area

success

Page 7: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

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

Page 8: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Example 03

1

0

xe dx

success

failure

Page 9: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Maple Commands

Activate random number generator for various probability distributions.

Can be used before the program (as shown) or within the program.

Page 10: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Maple Commands

Generate random numbers for uniform distributions.

Page 11: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Example 0What are the disadvantages?

Page 12: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Example 0What are the disadvantages? 1.2.3.4.

Page 13: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Monte Carlo Methods Statistical simulation methods Method that utilizes sequences of

random numbers to perform the simulations

Page 14: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

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!

Page 15: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

ClassworkWrite a program to estimate the value of the integral

31

0

xe dx

Page 16: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

Hint:3

1

0

xe dx

failure

success

Input n

Page 17: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

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.

Page 18: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

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.

Page 19: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

HW Problem 1Write a program to estimate the value of the integral

2

0

5sin xdx

Page 20: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

HW Problem 2Write a program to estimate the value of the integral

1 1

0 0

xye dxdy

Page 21: MAT 4830 Mathematical Modeling 04 Monte Carlo Integrations

HW Problem 3Design an experiment using Monte Carlo Integration to estimate the value of