Friday, June 1, 2012

Vpython Take 2 - Conclusion Part 2

The real  suprise of the whole Vpython project in physics had less to do with physics and more to do with the very last day of class.

Most of the students were able to complete their code with a day to spare. What I noticed as they were working on the physics problem was that it took some work on my part to tear them away from their own code, and to look at the code I had given them to actually approach the physics problem.

I decided to use the last day as a "coding free-for-all". The rules were simple: The students were to tutorial to push their program to "the limit". The only rule was to be as creative as possible and to "impress themselves". I was actually careful with this language. With my first block I said, "impress me" and then I quickly amended that to say, "No, impress yourselves."

What followed in each of my blocks was an eerie silence punctuated by questions every 10 minutes or so. Mostly the students seemed to be coding, looking up what they needed to  online or thinking. As an outsider used to lots of talking in my classroom, I assumed that things were going disastrously. I assumed that they were bored, frustrated, and spacing out. 



What I did not prepare myself for was the possibility that they were absolutely engaged in what they were doing.

I guess the moral is that if the task is engaging enough and the kids have enough freedom, they'll do amazing things. All of these projects are from kids who less than 1 week ago had absolutely no experience coding.

Here are some of the projects that the students wrote:

 

A 40 second clip of these programs is that it does not capture the blind alleys, mistakes, tenacity, joy, frustration the students experienced to produce these results. I want to include one last image, of the planning phase of the very last program featured in the clip just to give a small hint of what the kids went through to produce their work:


 

 
   I include this photo because it really captures the thinking that is required for modifying code even to do "simple things". This student had a modest goal which was to have four bouncy balls in four boxes, but to create new walls and position new spheres was tricky. She actually had to work out the coordinates and vector components on paper before she could code it. Even after doing all this, there was still a lot of trial and error. Even more amazingly, this created a "need to know" that she was not aware of, but I was as an (semi) experienced programmer. What she was looking for but did not know, was a method to allow all the spheres to bounce in their respective boxes but be governed by the same "function". If only there had been more time.


Just for kicks, I thought I'd include one last bit of code (unmodified) that a student of mine whimsically named "the eye of Sauron". If you run it, you might have to hit "command option" and rotate the screen to view it from above.


from visual import*
ball = sphere(pos=(5,0,-5), radius=1, color=color.red)
ball2=sphere(pos=(-4,0,4),radius=1,color=color.orange)
sol=sphere(pos=(0,0,0),radius=2,color=color.yellow)
ball.velocity = vector(5,0,5)
ball2.velocity=vector(-4,0,-4)
ball.trail = curve(color=ball.color)
ball2.trail=curve(color=ball2.color)
g=5
deltat = 0.005
t = 0
scene.autoscale=true
while t < 1000000:
    rate(10000)
    if ball.pos.z>0:
        ball.velocity.z=ball.velocity.z-deltat*g
    if ball.pos.z<0:
        ball.velocity.z=ball.velocity.z+deltat*g
    if ball.pos.x>0:
        ball.velocity.x=ball.velocity.x-deltat*g
    if ball.pos.x<0:
        ball.velocity.x=ball.velocity.x+deltat*g
    if ball2.pos.z>0:
        ball2.velocity.z=ball2.velocity.z-deltat*g
    if ball2.pos.z<0:
        ball2.velocity.z=ball2.velocity.z+deltat*g
    if ball2.pos.x>0:
        ball2.velocity.x=ball2.velocity.x-deltat*g
    if ball2.pos.x<0:
        ball2.velocity.x=ball2.velocity.x+deltat*g
    ball.pos = ball.pos + ball.velocity*deltat
    ball2.pos=ball2.pos+ball2.velocity*deltat
    ball.trail.append(pos=ball.pos)
    ball2.trail.append(pos=ball2.pos)
    t = t + deltat

Enjoy!

2 comments:

  1. "The Eye of Sauron" is beautiful, congratulations!

    jk

    ReplyDelete
  2. Thanks JK. I'm always thinking about horizontal alignment. These little exercises could be such a great way to get kids in Calc BC to really get a handle on parametric functions in a fun way.

    ReplyDelete