Skip to content

A Primer on Monte Carlo Methods. Examples: Monty Hall problem, Marathon Simulation, Simple Monte Carlo (sMC) -Andrew

License

Notifications You must be signed in to change notification settings

tamercs2005/monte-carlo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Primer on Monte Carlo Methods

Author: Andrew Garcia

Copyright 2019 Andrew Garcia

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

mc_simple.py

Simple Monte Carlo mc_simple.py: Sample inputs from their corresponding random distributions to generate output distribution.

drawing

drawing

monte_hall.py

Simulating Monte Hall problem through conditional selection (Monte Carlo algorithm)

drawing

drawing

montemarathon.py

The rejection sampling criterion:

U = [random number from uniform distribution (0,1)]

P(x) = Probability density function (e.g. ~ exp(-x**2))

if P(x) > U

     accept x (label with blue)

else

     reject x (label with orange)

drawing

can be understood to be based on the premise that sampling "U" values above those of a probability distribution of a certain event do not constitute a part of said event and are thus rejected.

Example: Marathon Race Outcomes under different strategies (run-jog-run/jog)

drawing

About

A Primer on Monte Carlo Methods. Examples: Monty Hall problem, Marathon Simulation, Simple Monte Carlo (sMC) -Andrew

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 85.3%
  • Python 14.7%