Hour of Physics Code 2016

trinket

College-Prep Physics: I’ve been coding with my AP Physics classes for years. But in honor of this week’s Hour of Code, I tried VPython programming for the first time with my College-Prep class. We used GlowScript, but in a Trinket environment so that students could edit the code without creating a GlowScript account.

Why are we coding in physics class?

I asked the students if they had ever seen the first Toy Story movie:

Toy Story 1 vs. Toy Story 3

Toy Story 1 vs. Toy Story 3: Compare the folds and wrinkles in Andy’s shirt.

Realistic motion is often too complicated for animators to do by hand, says Michael Kass, a researcher at Pixar Animation Studios. “The results can be awful and very expensive.” He points to the original 1995 Toy Story and notes that “if you see a wrinkle in clothing, it’s because an animator decided to put in a wrinkle at that point in time. After that we [at Pixar] decided to do a short film to try out a physically based clothing simulation.”

(excerpt from “Animation uses old physics to new effect” in Physics Today)

Then I showed this simple cloth physics engine:

clothsim
http://andrew-hoyer.com/experiments/cloth/

Next, we watched these short clips showing more advanced modeling of clothing, hair (from Tangled), and snow (from Frozen).

Now it was time for the students to tinker with some code which modeled our red and blue constant velocity buggies. Rather than have them do a tutorial from scratch, I gave them a pre-written program and asked them to make changes in order to create different outcomes. They worked in pairs, and I circulated around the room stamping their sheets as they accomplished each task. (The ♢♢ tasks require them to apply what they learned from the ♢ tasks.) Often there is more than one way to do each task.

trinket code

Resources:

For more info on how to incorporate programming and computational physics into an introductory physics course, I highly recommend reading this article:

Chabay, R. & Sherwood, B. (2008) Computational physics in the introductory calculus-based course. American Journal of Physics, 76(4&5), pp. 307-313. pdf abstract

Chabay and Sherwood also gave a related talk at a recent AAPT meeting:

For folks looking to start with something slightly more advanced activity, I recommend this GlowScript tutorial for a particle bouncing around inside a box.

About Frank Noschese

HS Physics Teacher constantly questioning my teaching.

Leave a comment