- Prof. Maurik Holtrop
Python notebooks and code for the computational recitation (Phys 601 & 602) at the University of New Hampshire. The aim is to learn how to solve the problems that come up in your physics courses numerically, and to become comfortable setting up that kind of work on your own. The recitation is a working session: bring your questions, bring your own computer, and bring problems from your other courses.
There are two ways to run the notebooks.
Open any notebook in Google Colab by replacing
https://github.com/ in its address with https://colab.research.google.com/github/.
To keep your changes, save a copy to your Google Drive. Try it with the first notebook:
Some times you will need to clone the repository in Google Colab if there are additional files needed to make the code work.
We suggest PyCharm together with a conda environment from Miniforge.
- First install Miniforge
- Scroll down to the Install section. Then follow the Windows or MacOS or Linux directions.
- For Windows install, you want the "miniforge prompt" option.
- Download the environment.yml file from this GitHub repository.
- At the "miniforge prompt" on Windows, or in the terminal on MacOS/Lunux create the environment for Physics 601:
conda env create -f environment
- Next install PyCharm. PyCharm's core version, including Jupyter notebook support, is free. Students can get the Pro version free through the JetBrains Student Pack.
- In PyCharm, clone this repository (
https://github.com/mholtrop/Phys601.git) with "Clone Repository" on the welcome screen. - In PyCharm, set the project interpreter: choose Conda and select the existing
phys601environment. (PyCharm may suggest uv or a new virtualenv instead; don't take that default.)- If you have multiple environments, you can set the environment in PyCharm by clicking the interpreter name at the bottom right of the screen and use the menu to choose another interpreter, or install another version.
If you prefer not to use PyCharm, JupyterLab works on its own. First install Miniforge (see above), next you can get the code and run JupyterLab:
git clone https://github.com/mholtrop/Phys601.git
cd Phys601
conda env create -f environment.yml
conda activate phys601
jupyter labIf you do not have git, use the green "Code" button above and choose "Download ZIP".
If any of this does not work for you, bring your laptop to recitation. Getting set up is part of the course.
Begin with Notebooks/00_Intro_Notebooks and the two 00_python_tutorial notebooks, then continue
in numerical order. You can also skip around, but you probably want to do "Basic Calculus" and
"Intro to Plotting". Notebooks starting with "A" are a bit more advanced;
those starting with "E" are extras.
Notebooks/README.md describes each one.
| Folder | Contents |
|---|---|
Notebooks |
The main sequence of notebooks |
Exercises |
Practice problems that go with the main notebooks |
Advanced |
Larger examples, with less step-by-step explanation |
QM_Notebooks |
Numerical quantum mechanics: bound states, time evolution, tunneling |
Special_Relativity |
Minkowski space-time diagram tools (used in Phys 505) |