Skip to content

cooper-goodman/monte-carlo-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monte-carlo-example

A simple example of Monte Carlo estimation of pi using geometric sampling.

Features

  • Estimate pi using random points inside a square and inscribed circle.
  • Two implementations:
    • Pure Python for-loop based (generate_estimates_for_loop)
    • Vectorized Polars lazy-frame based (generate_estimates_polars)
  • Easy creation of interactive scatter plots showing pi convergence.
  • Simple wrapper functions for quick experiments.

Installation

1. Clone the repository

cd C:/path/to/install/directory
git clone https://github.com/cooper-goodman/monte-carlo-example.git
cd monte-carlo-example

2. Install dependencies

2.1. pixi

This project was built with pixi a modern python package manager.

If pixi is installed it should automatically detect the pixi.toml and download the necessary packages.

cd "C:/path/to/install/directory/monte-carlo-example"
pixi install

2.2. pip

Dependencies can also be installed with pip.

pip install pandas shapely plotly polars pyarrow matplotlib

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages