This repository contains Python scripts developed for a the first assignment of Stochastic Simulation at the University of Amsterdam, 2023. The project focuses on the calculation of the area of the Mandelbrot set using Monte Carlo methods.
This file includes the core methods used in this project. It contains the implementation of the basic Mandelbrot iteration, functions to calculate the area and the three basic sampling techniques. It serves as the backbone for the simulations in other scripts and run by itself it creates plots of the fractals and where each sample lands for each sampling method.
antithetic.py
implements the antithetic equivalents of the sampling techniques, which is a variance reduction method in stochastic simulation. Otherwise, it has the same functionality as methods.py
.
This script is dedicated to performing statistical analysis on the data generated by the simulations. It imports the methods from methods.py
and antithetic.py
and includes functions for calculating key statistical measures, such as mean, variance, and confidence intervals. It outputs the data in .csv format.
In sample_convergence.py
, the focus is on analyzing the convergence behavior of simulations as the sample number increases while keeping the iteration number constant. It outputs a plot of the convergence behaviour of the sampling methods chosen and usilises the statistics from statistical_analysis.py
for the confidence intervals. This script also has the ability to perform time-per-simulation analysis.
Analogous to sample_convergence.py
This file examines the convergence properties in relation to the number of iterations, keeping the sample size constant.
This file has the ability to visualise the fractal in different colormaps and can zoom in on specific areas. It's purely for visualisation purposes and has no use for the calculations.
orthogonal.py
is a file to play around with and was created to run the simulation at the highest settings.
These scripts were run with Python 3.11.0 on MacOS Ventura. The main functions were converted to machine code using @jit in order to speed up the simulation. This was disabled for time-per-simulation analysis.
- matplotlib==3.7.1
- numba==0.57.0
- numpy==1.24.3
- pandas==1.5.3
- scipy==1.10.1
- seaborn==0.13.0
- statsmodels==0.14.0
[email protected] [email protected] [email protected]
Developed by Joana Costa e Silva, Bálint Szarvas and Sándor Battaglini-Fischer.