The following is a handout I give to participants in a short workshop on numerical calculations using python. This workshop is aimed at introductory college students or high school physics teachers or college faculty.
The following is a mostly up-to-date presentation that goes along with the questions. https://docs.google.com/presentation/d/1erNmpf_5ZUB9Vmc6uro49f220qcismnbkMzj4og7FtI/edit?usp=sharing
If you want a different form - here is a an online textbook with embedded python programs. https://trinket.io/rhettallain_gmail_com/courses/introductory-physics-with-python#/introduction/physics-and-python
Note this online version is incomplete.
Now for the supplements to the presentation.
Numerical Calculations Starter Programs
Here are the programs (along with the questions) that we will work through. If you prefer to use Glowscript, you can find all the programs here.
Constant Velocity
Object moving with a constant velocity (in 1-D). Starter program https://trinket.io/glowscript/3c5632203c?toggleCode=true
Constant Acceleration
An object moving with constant acceleration (in 1-D). Starter program: https://trinket.io/glowscript/54ff55930d?toggleCode=true
Graphs
Use the constant acceleration program above.
Mass on a Spring
Model the motion of a mass oscillating vertically on a spring. Starter program (incomplete) https://trinket.io/glowscript/b4e03c1284?toggleCode=true
Vectors
Here is a sample program that demonstrates some vector operations. https://trinket.io/glowscript/d6faf70ad3?toggleCode=true
3D Objects
Here are three common objects you can draw in 3D. Really, you just need the sphere. https://trinket.io/glowscript/b89ad98139?toggleCode=true
Moving in 3D
A simple program that has a sphere moving at a constant velocity. https://trinket.io/glowscript/740fed0059?toggleCode=true
Projectile Motion
This starter program has a ball that is launched straight up. I put a couple of hints in the program. Remember that a line starting with # is a comment. https://trinket.io/glowscript/5611775c5c?toggleCode=true
Air Resistance
Here is a sample program. It’s just like the projectile motion, but it has an extra force. https://trinket.io/glowscript/53d2efb4db?toggleCode=true
Orbits
Here is an incomplete program showing an object interacting with the Earth. https://trinket.io/glowscript/9266bff0c5?toggleCode=true
Three-Body Problem
This is just like the orbit problem above except there are three objects interacting. https://trinket.io/glowscript/eac36d51f1?toggleCode=true
Useful Links
Other Examples