Skip to content

dannycab/phy321msu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“š Classical Mechanics - PHY321 MSU

License: CC BY-NC-SA 4.0 Jupyter Book

A comprehensive course on Classical Mechanics taught at Michigan State University, combining traditional analytical methods with modern computational approaches.

๐ŸŽฏ Course Overview

  • Newton's Laws of Motion and their applications
  • Lagrangian and Hamiltonian mechanics
  • Differential equations in physics
  • Numerical methods and computational modeling
  • Real-world applications in research and industry

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • Git
  • Basic familiarity with Jupyter notebooks

๐Ÿ“ฅ Cloning the Repository

git clone https://github.com/dannycab/phy321msu.git
cd phy321msu

๐Ÿ Setting Up the Environment

  1. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up Jupyter kernel (for development):

    pip install ipykernel
    python -m ipykernel install --user --name=.venv --display-name "Python (.venv)"

๐Ÿ”ง Building the Book

Using the Unified Build Tool

The easiest way to build the book is using the unified build tool (ubt.py):

# Quick commands for common tasks
python ubt.py task update     # Build HTML incrementally  
python ubt.py task rebuild    # Update kernels and full rebuild
python ubt.py task pdf        # Build PDF version
python ubt.py task viewhtml   # Open HTML in browser
python ubt.py task viewpdf    # Open PDF in viewer
python ubt.py task all        # Full build pipeline

# More control with direct commands
python ubt.py book            # Build HTML version
python ubt.py book --builder pdflatex  # Build PDF
python ubt.py book --view     # Build and open in browser
python ubt.py slides slides/day-01.md  # Build specific slide

๐Ÿ“– See USAGE.md for complete command reference and examples

Manual Building

If you prefer to use Jupyter Book directly:

# Activate virtual environment first
source .venv/bin/activate

# Build HTML
jupyter-book build .

# Build PDF (requires LaTeX)
jupyter-book build . --builder pdflatex

๐Ÿ“ Project Structure

phy321msu/
โ”œโ”€โ”€ ๐Ÿ“– intro.md                    # Main landing page
โ”œโ”€โ”€ ๐Ÿ“‹ _toc.yml                    # Table of contents
โ”œโ”€โ”€ โš™๏ธ _config.yml                 # Jupyter Book configuration
โ”œโ”€โ”€ ๐Ÿ”ง ubt.py                     # Unified build tool (replaces build.py)
โ”œโ”€โ”€ ๐Ÿ“ requirements.txt           # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“š lecture-notes/              # Combined weekly materials
โ”‚   โ”œโ”€โ”€ 01_notes.ipynb
โ”‚   โ”œโ”€โ”€ 02_notes.ipynb
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ ๐Ÿ‘ฅ admin/                      # Course administration
โ”‚   โ”œโ”€โ”€ getting-started.ipynb
โ”‚   โ”œโ”€โ”€ teachers.md
โ”‚   โ””โ”€โ”€ textbooks.md
โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ images/                     # Course images and figures
โ”œโ”€โ”€ ๐Ÿ“Š slides/                     # Lecture slides (Marp format)
โ”œโ”€โ”€ ๐ŸŽฏ homeworks/                  # Problem sets (excluded from build)
โ”œโ”€โ”€ ๐Ÿ“ midterms/                   # Exams (excluded from build)
โ”œโ”€โ”€ ๐Ÿ”ฌ resources/                  # Additional materials (excluded from build)
โ””โ”€โ”€ ๐Ÿ† honors-projects/            # Advanced projects (excluded from build)

๐Ÿ› ๏ธ Development Workflow

Adding New Content

  1. Weekly materials: Add new notebook files to the lecture-notes/ directory
  2. Update TOC: Edit _toc.yml to include new files
  3. Build and test: Run python ubt.py task rebuild to ensure everything works

Combining Week Files

The project includes scripts to combine separate start and notes files:

# Combine individual week files (if needed)
python combine_all_weeks.py

# Update notebook kernels (done automatically by ubt.py)
python update_kernels.py

Working with Images

  • Store images in the images/ directory with appropriate subdirectories
  • Use relative paths: ../images/folder/image.png from lecture notes
  • Supported formats: PNG, JPG, SVG, GIF

๐ŸŽจ Customization

Configuration

Key settings in _config.yml:

  • Execution: Notebooks are executed on every build (execute_notebooks: force)
  • Math rendering: Uses MathJax 3 for LaTeX equations
  • Exclusions: Homework and exam files are excluded from the build
  • License: Content is licensed under CC BY-NC-SA 4.0

Themes and Styling

The book uses Jupyter Book's default theme with custom:

  • MSU Spartan helmet logo
  • Creative Commons license footer
  • GitHub integration buttons

๐Ÿ“– Content Organization

Weekly Structure

Each week typically contains:

  • Introduction/Overview: Setting up the week's topics
  • Lecture Notes: Detailed explanations with examples
  • Interactive Elements: Code cells for demonstrations
  • Mathematical Content: LaTeX-formatted equations

Special Features

  • ๐ŸŽฅ Embedded Videos: YouTube videos playable directly in pages
  • ๐Ÿงฎ Interactive Code: Python examples and calculations
  • ๐Ÿ“Š Visualizations: Matplotlib and other plotting libraries
  • ๐Ÿ“š References: Bibliography support with BibTeX

๐Ÿค Contributing

For Instructors

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-content
  3. Make your changes and test locally
  4. Submit a pull request with clear description

For Students

  • Report issues via GitHub Issues
  • Suggest improvements or corrections
  • Share interesting applications or extensions

Code Style

  • Follow PEP 8 for Python code
  • Use meaningful variable names
  • Include docstrings for functions
  • Comment complex equations and algorithms

๐Ÿ” Troubleshooting

Common Issues

Build Failures:

# Clean and rebuild
rm -rf _build/
python ubt.py task rebuild

Kernel Issues:

# Update all notebook kernels (or use rebuild which does this automatically)
python update_kernels.py
# Or use the unified tool:
python ubt.py task rebuild

Missing Dependencies:

# Reinstall requirements
pip install -r requirements.txt --upgrade

Image Path Problems:

  • Check that image paths are relative to the notebook location
  • Ensure images exist in the images/ directory
  • Use forward slashes in paths (even on Windows)

Getting Help

  • ๐Ÿ“ง Contact course instructors
  • ๐Ÿ› Open a GitHub Issue
  • ๐Ÿ’ฌ Check existing discussions

๐Ÿ“œ License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You are free to:

  • Share โ€” copy and redistribute the material
  • Adapt โ€” remix, transform, and build upon the material

Under the following terms:

  • Attribution โ€” Give appropriate credit
  • NonCommercial โ€” Not for commercial purposes
  • ShareAlike โ€” Distribute under the same license

๐Ÿ‘จโ€๐Ÿซ Authors

  • Danny Caballero - Michigan State University
  • Morten Hjorth-Jensen - Michigan State University
  • Rachel Henderson - Michigan State University

๐Ÿ™ Acknowledgments

  • Michigan State University Physics Department
  • Jupyter Book community
  • Open source scientific Python ecosystem
  • Students and colleagues who provided feedback

Built with โค๏ธ using Jupyter Book and the scientific Python ecosystem.


Repository Structure & Order of Materials

The course is organized in the following order, matching the learning progression:

  1. About the Course
    • Getting started, instructor info, and textbooks (admin/)
  2. Calendar & Lecture Materials
    • Course schedule, links, slides, and handwritten notes (admin/)
  3. Weekly Course Materials
    • Sequential lecture notes and starter notebooks for each week (lecture-notes/week*/)
    • Example: lecture-notes/week1/01_start.ipynb, lecture-notes/week1/01_notes.ipynb, ...
  4. Assignments
    • Homeworks and midterms in order of assignment (homeworks/, midterms/)
    • Example: homeworks/hw1.ipynb, ..., midterms/midterm1.ipynb, ...
  5. Resources
    • Rubrics, guides, computational essays, integrators, phase diagrams, and more (resources/)
  6. Honors Projects
    • Advanced and honors-level project topics (honors-projects/)
  7. Slides & Images
    • All lecture slides in multiple formats and supporting images (slides/, images/)
  8. Themes
    • Custom CSS and themes for slides and notes (themes/)

The order and structure are defined in _toc.yml and are reflected in the Jupyter Book build.


Contributing

Contributions, corrections, and suggestions are welcome! Please open an issue or submit a pull request.


License

See the LICENSE file for details.


README.md written by Ollama.

About

Physics 321 MSU Repo and Jupyter Book

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published