Skip to content

caverac/galactic-dynamics-bt

Repository files navigation

Galactic Dynamics (BT 2002) Solutions

Documentation Python License: MIT Code style: black

Solutions to the problem sets from Binney & Tremaine's Galactic Dynamics (2nd Edition). This repository contains Python implementations of numerical solutions, leveraging libraries such as NumPy, SciPy, and Matplotlib for efficient computation and visualization.

πŸ“š About

This project provides detailed solutions to problems from the seminal textbook Galactic Dynamics by James Binney and Scott Tremaine (2nd Edition, 2008). The solutions are implemented in Python and organized by chapter, featuring:

  • Analytical derivations with step-by-step mathematical explanations
  • Numerical implementations using modern Python scientific computing stack
  • Visualizations with publication-quality plots
  • Interactive documentation with mathematical formulas and figures (https://caverac.github.io/galactic-dynamics-bt/)

πŸš€ Quick Start

Prerequisites

  • Python 3.12 or higher
  • uv package manager (recommended) or pip

Installation

  1. Clone the repository:

    git clone https://github.com/caverac/galactic-dynamics-bt.git
    cd galactic-dynamics-bt
  2. Install dependencies using uv:

    uv sync

    Or using pip:

    pip install -e .

Running the Code

Generate figures and run solutions:

# Generate plots for Chapter 1
uv run python scripts/generate_assets.py

# Run all tests
uv run pytest

# Build documentation
uv run mkdocs serve

# Build documentation - live
uv run mkdocs serve --livereload

πŸ“– Documentation

The complete documentation with mathematical derivations, figures, and code explanations is available at:

https://caverac.github.io/galactic-dynamics-bt/

Local Documentation

To build and serve the documentation locally:

uv run mkdocs serve

Then open http://localhost:8000 in your browser.

πŸ“ Project Structure

galactic-dynamics-bt/
β”œβ”€β”€ docs/                          # Documentation source
β”‚   β”œβ”€β”€ assets/                    # Generated figures and images
β”‚   β”œβ”€β”€ chapterX.md                # Chapter X solutions
β”‚   └── index.md                   # Homepage
β”œβ”€β”€ galactic-dynamics-bt/          # Source code
β”‚   └── chapterX/                  # Chapter X implementations
β”‚       └── y.py                   # Implementation for problem y
β”œβ”€β”€ tests/                         # Test suite
β”‚   └── unit/                      # Unit tests
β”œβ”€β”€ scripts/                       # Utility scripts
β”œβ”€β”€ main.py                        # MkDocs macro definitions
β”œβ”€β”€ pyproject.toml                 # Project configuration
└── mkdocs.yml                     # Documentation configuration

πŸ”¬ Implemented Solutions

Chapter 1: Introduction

  • Problem 1.1: Perihelion precession in constant density background
  • Problem 1.11: FRW cosmological models and universe boundaries
  • More solutions coming soon...

πŸ§ͺ Development

Setting up Development Environment

  1. Install development dependencies:

    uv sync --group dev
  2. Install pre-commit hooks:

    uv run pre-commit install
  3. Run code quality checks:

    # Format code
    uv run black src tests
    
    # Lint code
    uv run flake8 src
    
    # Type checking
    uv run mypy src
    
    # Run tests
    uv run pytest

Generating Releases

This project uses Commitizen for semantic versioning:

# Bump version and create changelog
uv run cz bump

# Push changes and tags
git push --follow-tags

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines on:

  • Setting up the development environment
  • Code style and quality standards
  • Submitting pull requests
  • Adding new problem solutions

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE.md file for details.

🎯 Roadmap

  • Solutions for Chapter 1: Introduction
  • Solutions for Chapter 2: Potential Theory
  • Solutions for Chapter 3: The Orbits of Stars
  • Solutions for Chapter 4: Equilibria of Collisionless Systems
  • Solutions for Chapter 5: Stability of Collisionless Systems
  • Solutions for Chapter 6: Disk Dynamics and Spiral Structure
  • Solutions for Chapter 7: Kinetic Theory
  • Solutions for Chapter 8: Collisions and Encounters of Stellar Systems
  • Solutions for Chapter 9: Galaxy Formation
  • Interactive Jupyter notebooks
  • 3D visualizations for orbital mechanics
  • Animation support for time-dependent solutions

πŸ“§ Contact

Carlos Vera-Ciro - [email protected]

Project Link: https://github.com/caverac/galactic-dynamics-bt

πŸ™ Acknowledgments

  • James Binney and Scott Tremaine for their excellent textbook Galactic Dynamics
  • The Python scientific computing community for the amazing tools
  • Contributors and users of this repository

πŸ“š References

Binney, J., & Tremaine, S. (2008). Galactic Dynamics (2nd ed.). Princeton University Press.

About

Solutions to the problem sets from Binney & Tremaine's Galactic Dynamics (2nd Edition)

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •