I recently facilitated a workshop for high school physics teachers in South Africa (two workshops actually—one in Johannesburg and one in Cape Town). The goal of the workshop was to introduce teachers to using python in physics. Since this was my first python-physics workshop, I feel I should share the details and some of the things I learned.

### The Workshop Content

This was a four hour workshop so I had plenty of time (or so I thought) to let the teachers actually work on some python code. I started off with an introduction and short lecture on the basic idea of numerical calculations. After that, I would start with some example code (maybe complete or maybe incomplete) and then give the teachers time to work on some “homework” questions about that code.

You can find all my workshop notes (with links to code) in this Google doc. Yes, I probably should have used something other than a Google doc, but more on that later. But let me go over the basic outline.

• Start with an object moving at a constant velocity and in one dimension. Go over the code and then give the participants an opportunity to change the code to answer some homework questions. Note: I decided to start off with very simple code. The results are printed out and there are no graphs and no 3D elements.
• An object moving in 1D with a constant acceleration. This is essentially the same as the program above but with a non-zero acceleration.
• Introduction to graphs. First, I show how to add a graph to the same constant acceleration problem and then I give the teachers a problem with two moving objects and they use a graph to find when these objects meet.
• Mass on a vertical spring. This is a short mini-lecture in which I show both how to model the force due to a stretched spring and then how to make a python model of a mass oscillating on a vertical spring. I show what the output should look like and then give the participants code with some parts missing. After they get the program running, there are some questions to suggest things they could change.
• Vectors and vector operations. This is just a demonstration of how VPython handles vectors. I have a sample code, but I don’t give them any questions to work on. Instead we just move to the next thing.
• Introduction to 3D objects. I show the VPython objects: sphere, box, arrow. After that I show a simple example of a ball tossed in the air (straight up) with 3D visualizations. There is no homework for the participants, this is just a demo.
• Projectile motion. The teachers are given the program of the ball tossed in the air (from the previous example) and then they need to make it a program with a ball tossed at angle.
• I have more programs to go over, but in both workshops we were running out of time. I showed a demonstration of projectile motion with air resistance and orbital motion.

Again, all of these starter programs are in the resource document. That document also contains a link to the presentation I used in the workshop as well as other useful links.

### Issues and Suggestions

As with any workshop, there are unexpected issues that come up. Here are some of the things that I learned from the two workshops.

• This was a BYOD (bring your own device) workshop. About half the faculty used a laptop computer but the others used tablets (the iPad was popular) or even their phones. I have to admit that I was surprised at how well these things worked on just a phone—sure it’s difficult to edit and read, but it works.
• Make sure you have enough power outlets. For the second workshop, there were only about 6 power outlets available to the faculty. This was an obvious issue in the second half of the workshop when the laptop users started running out of energy.
• Trinket.io works better than Glowscript. In general, I like to use Glowscript over Trinket. However, in a workshop it seemed easier to provide links to sample programs in Trinket.io. With Trinket, the users could just go ahead and start running/editing the code. In Glowscript, they need to first login with a Google ID then open my code and copy-paste into a new window. Those extra steps can really cause some problems.
• A four-hour workshop might seem like a long time, but it’s pretty difficult to get through all the examples I wanted. I don’t think the faculty could handle anything longer—maybe it should be a two day event.
• There might be some issues with browsers. I noticed at least one case where a user had a problem with Safari on an iPad. However, the code worked when it was tried in the Chrome browser. Just be aware of these issues.
• Originally, I had all of my resources on an editable Google doc file. It was editable so that participants could add questions as they worked through the material. This was a huge mistake. There were several cases where a link was accidentally deleted. For the second workhops, I just decided to make the document viewable only.
• Speaking of editing, be careful with Trinket. I created some sample programs for the users to start the activities. Trinket is nice since they can just start editing the program but it doesn’t change the “master” code. However, if I want to show an example on the projector to the whole workshop, I have to be careful. Editing the code when logged in as me (the creator) changes it for everyone. Oops.

OK, some final comments. First, I would like to thank Mark Horner and Colleen Henning for their excellent hospitality during my time in South Africa. Second, before my trip everything I knew about South Africa I learned from Lethal Weapon 2 and District 9. Neither of these movies accurately portray South Africa.

Lastly, here is a picture of some penguins near Cape Town.

Rhett Allain

Original article:

How to Use Python to Teach High School Physics