Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 1.63 KB

File metadata and controls

69 lines (45 loc) · 1.63 KB

Pi Approximation Algorithms

This project contains a collection of Python implementations for approximating $\pi$ using different mathematical methods, including Chudnovsky, Machin-like formulas, Leibniz, Borwein, and more.

Features

  • Multiple Pi approximation algorithms in separate Python files
  • A central launcher to choose and run methods interactively
  • Optimized implementations that preserve the original mathematical logic
  • Simple test coverage for selected algorithms

How to Run

  1. Open the project folder.
  2. Run the launcher:
python -m pi_approximation_algorithms
  1. Choose a method from the menu.

Project Structure

  • src/pi_approximation_algorithms/cli.py – interactive menu to run algorithms
  • src/pi_approximation_algorithms/algorithms/ – individual Pi approximation implementations
  • tests/ – basic regression tests for optimized methods

Requirements

  • Python 3.x

Install the project in editable mode before using the module command:

python -m pip install -e .
python -m pi_approximation_algorithms

Docker

Build and start the interactive launcher with:

docker compose run --rm pi-approximation

The container expects an interactive terminal because the launcher prompts for an algorithm selection. To run it directly instead:

docker build -t pi-approximation .
docker run --rm -it pi-approximation

Development

Compile-check all Python files locally with:

python -m compileall -q src

GitHub Actions runs this check on pushes and pull requests across supported Python versions.

License

This project is provided for educational purposes.