Python scripts for demonstrating key concepts used in the physical sciences
Before you can run the scripts, you need to install Python and set up some libraries. Follow these steps:
- Download Python 3.12 from the official Python website.
- During installation, ensure you check the option
Add Python 3.12 to PATHto make Python accessible from the command line.
Open your command line interface by typing cmd in the searchbar (windows users) or by typing Terminal in Spotlight Search (press Cmd + Space to open Spotlight; Mac users) and install the necessary Python libraries by typing:
pip install numpy scipy matplotlib-
Go to the GitHub repository containing the scripts.
-
Navigate to the Module1_PythonSupplements folder.
-
Download the desired scripts by clicking on each file and then clicking Download raw file (downwards arrow in the header of the code). The available scripts are:
-
Binomial Distribution coin flip simulator. Download
Binom_Dist_Coinflip.pyand save the file somewhere accesible on your main wokring drive (like a Desktop folder). Execute the code the double clicking or running via your preferred Python environment. -
Particle on a ring wavefunctions (Rigid-Rotor). Download
particle_on_a_ring_probDistrib.pyand save the file somewhere accesible on your main wokring drive (like a Desktop folder). Execute the code the double clicking or running via your preferred Python environment. Execute the code the double clicking or running via your preferred Python environment. -
Hydrogen orbitals. Download the
Hydrogen_orbitalsfolder and save the file somewhere accesible on your main wokring drive (like a Desktop folder). Execute the code by double clicking Launcher.py (not hydrogen.py - this is where the math is done!) Launcher.py is found within \Hydrogen_orbitals.-
For very large values of n and l, you may need to adjust the resolution by increasing the value of s located on line 54.
-
The math to plot the probability distributions was adapted from https://github.com/liam-ilan/electron-orbitals. Please cite accordindly if you use this in your teaching.
-
-