Who’s gone overboard modeling w/ Python? Part II - Gravitation

I was working on orbits and gravitation with my AP Physics B students, and as has always been the case (including with me in high school), they were having trouble visualizing exactly what it meant for something to be in orbit. They did well calculating orbital speeds and periods as I asked them to do for solving problems, but they weren't able to understand exactly what it meant for something to be in orbit. What happens when it speeds up from the speed they calculated? Slowed down? How would it actually get into orbit in the first place?

Last year I made a Geogebra simulation that used Euler's method  to generate the trajectory of a projectile using Newton's Law of Gravitation. While they were working on these problems, I was having trouble opening the simulation, and I realized it would be a simple task to write the simulation again using the Python knowledge I had developed since. I also used this to-scale diagram of the Earth-Moon system in Geogebra to help visualize the trajectory.

I quickly showed them what the trajectory looked like close to the surface of the Earth and then increased the launch velocity to show what would happen. I also showed them the line in the program that represented Newton's 2nd law - no big deal from their reaction, though my use of the directional cosines did take a bit of explanation as to why they needed to be there.

I offered to let students show their proficiency on my orbital characteristics standard by using the program to generate an orbit with a period or altitude of my choice. I insist that they derive the formulae for orbital velocity or period from Newton's 2nd law every time, but I really like how adding the simulation as an option turns this into an exercise requiring a much higher level of understanding. That said, no students gave it a shot until this afternoon. A student had correctly calculated the orbital speed for a circular orbit, but was having trouble configuring the initial components of velocity and position to make this happen. The student realized that the speed he calculated through Newton's 2nd had to be vertical if the initial position was to the right of Earth, or horizontal if it was above it. Otherwise, the projectile would go in a straight line, reach a maximum position, and then crash right back into Earth.

The other part of why this numerical model served an interesting purpose in my class was as inspired by Shawn Cornally's post about misconceptions surrounding gravitational potential and our friend mgh. I had also just watched an NBC Time Capsule episode about the moon landing and was wondering about the specifics of launching a rocket to the moon. I asked students how they thought it was done, and they really had no idea. They were working on another assignment during class, but while floating around looking at their work, I was also adjusting the initial conditions of my program to try to get an object that starts close to Earth to arrive in a lunar orbit.

Thinking about Shawn's post, I knew that getting an object out of Earth's orbit would require the object reaching escape velocity, and that this would certainly be too fast to work for a circular orbit around the moon. Getting the students to see this theoretically was not going to happen, particularly since we hadn't discussed gravitational potential energy among the regular physics students, not to mention they had no intuition about things moving in orbit anyway.

I showed them the closest I could get without crashing:

One student immediately noticed that this did seem to be a case of moving too quickly. So we reduced the initial velocity in the x-direction by a bit. This resulted in this:

We talked about what this showed - the object was now moving too slowly and was falling back to Earth. After getting the object to dance just between the point of making it all the way to the moon (and then falling right past it) and slowing down before it ever got there, a student asked a key question:

Could you get it really close to the moon and then slow it down?

Bingo. I didn't get to adjust the model during the class period to do this, but by the next class, I had implemented a simple orbital insertion burn opposite to the object's velocity. You can see and try the code here at Github. The result? My first Earth - lunar orbit design. My mom was so proud.

The real power here is how quickly students developed intuition for some orbital mechanics concepts by seeing me play with this. Even better, they could play with the simulation themselves. They also saw that I was experimenting myself with this model and enjoying what I was figuring out along the way.

I think the idea that a program I design myself could result in surprising or unexpected output is a bit of a foreign concept to those that do not program. I think this helps establish for students that computation is a tool for modeling. It is a means to reaching a better understanding of our observations or ideas. It still requires a great amount of thought to interpret the results and to construct the model, and does not eliminate the need for theoretical work. I could guess and check my way to a circular orbit around Earth. With some insight on how gravity and circular motion function though, I can get the orbit right on the first try. Computation does not take away the opportunity for deep thinking. It is not about doing all the work for you. It instead broadens the possibilities for what we can do and explore in the comfort of our homes and classrooms.

Simulations, Models, and the 2012 US Election

After the elections last night, I found I was looking back at Nate Silver's blog at the New York Times, Five Thirty Eight.

Here was his predicted electoral college map:

...and here was what ended up happening (from CNN.com):

I've spent some time reading through Nate Silver's methodology throughout the election season. It's detailed enough to get a good idea of how far he and his team  have gone to construct a good model for simulating the election results. There is plenty of description of how he has used available information to construct the models used to predict election results, and last night was an incredible validation of his model. His popular vote percentage for Romney was predicted to be 48.4%, with the actual at 48.3 %. Considering all of the variables associated with human emotion, the complex factors involved in individuals making their decisions on how to vote, the fact that the Five Thirty Eight model worked so well is a testament to what a really good model can do with large amounts of data.

My fear is that the post-election analysis of such a tool over emphasizes the hand-waving and black box nature of what simulation can do. I see this as a real opportunity for us to pick up real world analyses like these, share them with students, and use it as an opportunity to get them involved in understanding what goes into a good model. How is it constructed? How does it accommodate new information? There is a lot of really smart thinking that went into this, but it isn't necessarily beyond our students to at a minimum understand aspects of it. At its best, this is a chance to model something that is truly complex and see how good such a model can be.

I see this as another piece of evidence that computational thinking is a necessary skill for students to learn today. Seeing how to create a computational model of something in the real world, or minimally seeing it as an comprehensible process, gives them the power to understand how to ask and answer their own questions about the world. This is really interesting mathematics, and is just about the least contrived real world problem out there. It screams out to us to use it to get our students excited about what is possible with the tools we give them.

First day of Geometry proofs - Refining my process

Fatal error: Cannot declare class VideoPress_Video, because the name is already in use in /home/weinbergmath/webapps/blog/wp-content/plugins/jetpack/modules/videopress/class.videopress-video.php on line 7