Playing with Physics: Pyret Is Not Just Coding


By Alvin Jiang | August 2018

STEMteachersNYC is an organization that helps educators explore different approaches to teaching in science, technology, engineering, and mathematics. Their programs utilize a teaching approach called modeling instruction where participants use whiteboards to develop models of physical phenomena and allow small groups to take notes and think from each other’s perspective. I am currently participating in a workshop called “Computational Modeling in Physics.” The workshop focuses on using computer programing (the programing language “Pyret”) to solve physics problem. The two leaders of the CMP workshop are both teachers, with ten physics teachers and two student interns making up the entire class.

First of all, let’s meet the leaders and the instructors of this workshop:

Josh Rutberg is currently working on a Ph.D. degree in physics. Rutberg has been learning Pyret for the past two years, along with C++ and HTML, other programming languages. Rutberg teaches an undergraduate course in a physics lab. As a workshop leader, Rutberg is a passionate figure. Through the workshop, Rutberg hopes to discover more about workshop leadership and professional development for teachers. He also expects workshop attendants to participate with an open mind and clearly state their needs, to always bring their questions to class. “And always bring some snacks,” said Rutberg.


Emily Pontius is the other leader of the Computational Modeling workshop. Pontius studied chemistry, and also completed some computational modeling in graduate school, at the time that Fortran was predominant. One year ago, she started Pyretting (learning Pyret). Pontius said it is great to learn a different programming language. Pontius’ goals are to make the other teachers and students interns feel comfortable to simulate motions and directions in physics, and especially to help students understand physics with modeling, and really observe the effect of physical changes (in relative position, and in objects’ functions).

This STEMteachersNYC workshop took place in the science department of Trinity School (New York City). The workshops have two different modes: teacher mode and student mode. In teacher mode, all participants, including the student interns, discuss how to create a productive and fascinating classroom environment, and how to give student proper feedbacks and grades. Then, all participants switch to student mode, when they learn and think as students. This helps the teachers to better understand what and how the students think. The workshops always switch back and forth between different topics. Rutberg and Pontius used a sign on the model of an Egyptian grasshopper’s front and back sides to indicate the different modes. When one side of the grasshopper is shown to the class, we know we are in student mode. And if the other side faces the classroom, we will be in teacher mode.

A majority of the day is spent on whiteboarding. In this section, all of the participants work in groups to gather final data and make conclusions on experiments. Then, each group writes their thoughts on their whiteboard. After the information is written, every one meets in the middle of the classroom to share their whiteboards, and discuss the outcome.

When trying to use real-life stories to understand the conservation of energy, our group came up with a whiteboard with the story of “the conservation of batteries.” This story illustrates that if no battery was added to the system (in this case, Timmy’s bedroom), the amount of batteries in the system stays the same, whether the battery is conserved in a toy car or it is visible on the floor. In the conservation of energy, it is the storage mode of energy that was modified. Energy can also be added into the system. For example, when Timmy’s mother bought him new batteries. Our group, then, shared the story of the battery with the class.

After we developed our story, Rutberg concluded that each group explored energy storage in different ways — using the t “the conservation of batteries,” “pennies,” “students,” and “dollar bills” as examples.

After this, we started a new experiment, adding washers to the end of a sensitive metal spring. As washers are added, the spring is stretched. The goal was to understand the relationship between the length of the stretch and the number of washers added.

Our group found that the number of washers and the length of the spring is in fact in a direct ratio. On the whiteboard, we sketched the function of this relationship. The data revealed that when more and more washers exert a downward force on the spring, the washers’ storage mode of gravitational energy is changed into the storage mode of elastic energy in the spring. As a result, the spring changes in length in response of the increase in elastic energy.

One of the workshop’s members, Matthew Cauchy, compared and contrasted each group’s white board. Besides physics, another important part of our computational modeling workshop is programming with Pyret. The workshop started with learning programming concepts, coding linear functions, and graphing basic images. These procedures are all done with precise coding. After learning some basic coding, we then try to simulate changes and interactions in physics using Pyret.

On the whiteboard show in the picture above, the group is designing the programming function with the input “temperature in degree Fahrenheit, T(°F),” and how it computes to the output “temperature in degree Celsius, T(°C).”
The linear function demonstrating the relationship between T(°C) and T(°F) is:
T(°C) = 5/9(T(°F)-32)

Through the process of learning programming with Pyret, I discovered that functions in general and computer coding consume the input, and gives the output. Functions and codings are not changing the numbers; but rather than taking the input(s), and letting it go under a series of changes, and offering the output.

After writing down the design recipe, our group coded the program on Pyret. As what it says, the function temp-F-to-C takes a Number (temperature in °F), and produces a Number (temperature in °C).

Then we ran the program. Our function is written correctly and both of the examples passed. We tried using 81°F as an input. After a set of calculation, the computer returned “26.984°C” as the output and final result.

On table 5: Katie Sandling and Shakeel Mehmood are discussing the topic.








Last but not least, let’s hear the opinions from some other attendants over the past week on this workshop!

Elissa Levy teaches in an urban school in the United States with a high-needs student population. The school has 600 students in total, and Levy teaches 9th grade physics. Levy’s expectation on this program is to learn how to teach mathematical and computational modeling to students. So far, Levy has got what she expects, she really appreciates the program. Another thing she both wanted and experienced is to hear opinions from the other colleagues.

Shakeel Mehmood teaches in Pakistan. Mehmood’s school has 1500 students, and he teaches physics from 10th grade through 12th grade. Mehmood is looking forward to teaching in a high school in the States in two years. Mehmood wants to solve complex problems and difficult topics of physics using computational modeling through this 3-week workshop. He thinks visualizing the problems will be a very useful tool. So far, Mehmood had learnt basics on Pyret, and he thinks it is good to work with his peers.

William “Bill” Canham is a teacher at the Hong Kong International School, with a student population of 750. He teachers regular physics, honors physics, AP physics, and astronomy. His workshop-goals are to create simulation on Pyret, and to teach kids how to do some coding under the context of physics. So far, Canham is able to learn some coding on his own, and he is happy with that.


Finally, as I become a high school junior this Fall, I will put both Physics and Computer Science in my schedule for the year. This workshop was the first time I received advanced education on these two subjects, and I have gained a lot.