Tag Archive | Glowscript

Day 65: Hour of Physics Code

wpid-img_20141211_121530354_hdr.jpg

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:

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

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

Day 42: Modeling a Falling Coffee Filter in GlowScript

fallingfilter3

AP Physics C: Yesterday, students took their data from the falling coffee filter lab and created a model of it in VPython. The terminal velocity of the filters in their computer model should match that of their experimental data.

We’ve been having a some computer issues with installing VPython on the school computers, and so pair programming has slowly evolved into groups of 3 and 4. I decided to check out GlowScript again and discovered that it now uses RapydScript, which means the code is almost identical to Python. There are some difference in how the 3D shapes are defined, but it’s not a big deal with the online reference at your side. I tried to code the coffee filter program myself in GlowScript. Based on how close the code is to VPython, I’m seriously considering switching over to GlowScript for the rest of the year. I showed the program in class today, and they liked the in-browser aspect of GlowScript.

You can see my code for the coffee filter program here: Falling Coffee Filter.

NGSS Science & Engineering Practices:
#2. Developing and Using Models

#5. Using Mathematics and Computational Thinking

Day 18: Gravitational Force in VPython

image

AP Physics C: Students programmed a visualization of gravitational force between a spacecraft and a planet. It’s a great exercise that helps emphasize its vector nature, where the negative sign in the universal gravitational force equation vibes from, and unit vectors.

Bonus: The screenshot is taken from my phone! Glowscript (a web-based version of VPython) works in the Chrome browser on my Android 4.2.2 phone.