A comprehensive course on Classical Mechanics taught at Michigan State University, combining traditional analytical methods with modern computational approaches.
- 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
- Python 3.8+
- Git
- Basic familiarity with Jupyter notebooks
git clone https://github.com/dannycab/phy321msu.git
cd phy321msu-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up Jupyter kernel (for development):
pip install ipykernel python -m ipykernel install --user --name=.venv --display-name "Python (.venv)"
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
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 pdflatexphy321msu/
โโโ ๐ 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)
- Weekly materials: Add new notebook files to the
lecture-notes/directory - Update TOC: Edit
_toc.ymlto include new files - Build and test: Run
python ubt.py task rebuildto ensure everything works
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- Store images in the
images/directory with appropriate subdirectories - Use relative paths:
../images/folder/image.pngfrom lecture notes - Supported formats: PNG, JPG, SVG, GIF
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
The book uses Jupyter Book's default theme with custom:
- MSU Spartan helmet logo
- Creative Commons license footer
- GitHub integration buttons
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
- ๐ฅ 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
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-content - Make your changes and test locally
- Submit a pull request with clear description
- Report issues via GitHub Issues
- Suggest improvements or corrections
- Share interesting applications or extensions
- Follow PEP 8 for Python code
- Use meaningful variable names
- Include docstrings for functions
- Comment complex equations and algorithms
Build Failures:
# Clean and rebuild
rm -rf _build/
python ubt.py task rebuildKernel 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 rebuildMissing Dependencies:
# Reinstall requirements
pip install -r requirements.txt --upgradeImage 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)
- ๐ง Contact course instructors
- ๐ Open a GitHub Issue
- ๐ฌ Check existing discussions
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
- Danny Caballero - Michigan State University
- Morten Hjorth-Jensen - Michigan State University
- Rachel Henderson - Michigan State University
- 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.
The course is organized in the following order, matching the learning progression:
- About the Course
- Getting started, instructor info, and textbooks (
admin/)
- Getting started, instructor info, and textbooks (
- Calendar & Lecture Materials
- Course schedule, links, slides, and handwritten notes (
admin/)
- Course schedule, links, slides, and handwritten notes (
- 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, ...
- Sequential lecture notes and starter notebooks for each week (
- Assignments
- Homeworks and midterms in order of assignment (
homeworks/,midterms/) - Example:
homeworks/hw1.ipynb, ...,midterms/midterm1.ipynb, ...
- Homeworks and midterms in order of assignment (
- Resources
- Rubrics, guides, computational essays, integrators, phase diagrams, and more (
resources/)
- Rubrics, guides, computational essays, integrators, phase diagrams, and more (
- Honors Projects
- Advanced and honors-level project topics (
honors-projects/)
- Advanced and honors-level project topics (
- Slides & Images
- All lecture slides in multiple formats and supporting images (
slides/,images/)
- All lecture slides in multiple formats and supporting images (
- Themes
- Custom CSS and themes for slides and notes (
themes/)
- Custom CSS and themes for slides and notes (
The order and structure are defined in _toc.yml and are reflected in the Jupyter Book build.
Contributions, corrections, and suggestions are welcome! Please open an issue or submit a pull request.
See the LICENSE file for details.
README.md written by Ollama.