Skip to content

dimkov41/MonteCarloSimulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Monte Carlo Simulation

This repository contains a Jupyter Notebook that demonstrates the concept of Monte Carlo simulation and its application in numerical integration. The notebook provides an explanation of simulation, its advantages and disadvantages, and the role of statistics in simulation. It also presents an example simulation of a spring system traveling downstairs and discusses the behavior outcomes that can be predicted.

The notebook then delves into numerical integration techniques, specifically the midpoint rule, which approximates the value of a definite integral. The implementation of the midpoint rule is demonstrated, along with an explanation of the error associated with the approximation.

Next, the notebook introduces Monte Carlo simulation as a powerful technique for estimation and approximation. It explains the underlying principles of the Monte Carlo method and its application in numerical integration. The implementation of Monte Carlo simulation for numerical integration is provided, along with a comparison to the midpoint rule approach. The performance, accuracy, and execution time of both methods are discussed.

To visualize the convergence and accuracy of the approximation methods, the notebook includes a plot that shows how the error decreases with an increasing number of subintervals or iterations. This plot enables users to observe the trade-off between execution time and accuracy and make informed decisions based on their specific requirements.

Lastly, a real-life application of Monte Carlo simulation is presented, focusing on comparing the cleaning time of a group of Roomba-like robots using different strategies. The simulation considers a simplified model of a single robot operating in a 5x5 square room and demonstrates how Monte Carlo simulation can be employed to analyze and optimize real-world scenarios.

Contents

  • Introduction
  • Simulation
    • What is simulation?
    • Advantages of doing simulations
    • Disadvantages of doing simulations
    • Example simulation: Spring system traveling downstairs
    • The role of statistics in simulation
  • Numerical Integration
    • What is numerical integration?
    • Midpoint rule
    • Implementation of the midpoint rule
    • Error for midpoint approximation
  • Monte Carlo Simulation
    • What is Monte Carlo simulation?
    • Implementation of Monte Carlo simulation for numerical integration
  • Comparison and Analysis
    • Performance and execution time comparison
    • Accuracy comparison using error analysis
    • Plotting convergence and error analysis
  • Real-Life Application
    • Simulation problem: Roomba-like robots cleaning a room
    • Methodology and results

Requirements

  • Python 3.x
  • Jupyter Notebook
  • matplotlib
  • numpy

Acknowledgements

The example simulation and code implementation in this notebook were inspired by various sources and educational materials on Monte Carlo simulation, numerical integration, and simulation analysis. The references used in creating this notebook are cited within the code as appropriate.

Feel free to explore the notebook and experiment with different parameters, assumptions, and scenarios to deepen your understanding of Monte Carlo simulation and its applications in statistical analysis and decision making.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published