# Day 65: Hour of Physics Code

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 the GlowScript version of VPython, which can now run regular VPython code inside a browser. Nothing to install!

Why are we coding in physics class?

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

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:
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 VPython 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.

Resources:

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

NGSS Science and Engineering Practices:
#5. Using mathematics and computational thinking

Tags: ,

HS Physics Teacher constantly questioning my teaching.

### 4 responses to “Day 65: Hour of Physics Code”

1. Mr. T says :

Hey Frank,

You might be interested in checking out a really great (and free) online resource called “The Nature Of Code” – natureofcode.org . The site takes you through some easy and then quite complicated units on simulating natural phenomenon. Daniel Shiffman (the author) is a great writer with a great sense of humor. The illustrations are great, and the examples are great. The language used is called Processing and it too allows for easy coding of animations (2D and 3D).

I teach an introduction to computer programming course as well as AP Physics too (I use the modeling pedagogical approach as well) and I am looking to integrate coding of simulations more into my Physics class. If you get a chance, could you let me know how and when you incorporate these coding activities into your modeling curriculum? Thanks.

• Mr. T says :

Sorry, the website is natureofcode.com.

• paulbianchi says :

Hey Frank, ditto on”The Nature of Code”. I’ve started using Processing (the parent language of Arduino, and the language in the “Nature” book) with my AP-C students, and it seems to have a relatively gentle curve for getting decent (2d so far) graphics.
Paul