Spring Motion and Numerical Calculations

Maybe you know I like numerical calculations, well I do. I think they are swell. [VPython](http://vpython.org) is my tool of choice. In the post [Basics: Numerical Calculations](http://blog.dotphys.net/2008/10/basics-numerical-calculations/) I used vpython and excel to do something simple. I will do that again today (in that this problem could also be solved analytically). However, there is one big difference. This problem has a non-constant forces. Suppose I have a mass that is connected by a spring to a wall. This mass-spring is sitting on a table with no friction.

![Screenshot 27](http://blog.dotphys.net/wp-content/uploads/2008/10/screenshot-272.jpg)

There is a very interesting property of springs. The more you stretch them, the greater the force they exert (in the usual model of springs). This model works very well.

![Screenshot 28](http://blog.dotphys.net/wp-content/uploads/2008/10/screenshot-282.jpg)

This is known as Hooke’s law. I have written it as a scalar for simplicity. The “k” is called the spring constant. It is a measure of how “stiff” the spring is. The value “s” is the amount the spring is stretched. Typically, there is a minus sign in front of the ks to indicate that the force is in the opposite direction that the spring is stretched. Really, in a scalar equation this is rather silly to include (but everyone does anyway).

**Question: What will the motion of the mass be like if I pull it back and then let go?**

Although this can be determined analytically, I am going to first calculate this with vpython. I will try to show all the details so that you can reproduce this also. If you have not already installed [vpython](http://vpython.org), do that now (don’t cost nothing).

Continue reading “Spring Motion and Numerical Calculations”

A physics-based Scratch game

I already said I like [scratch from MIT](http://scratch.mit.edu). After building a simple rocket model, the kids said it should be a game. I caved. Here it is:

Learn more about this project

To play, press the space bar. The arrow keys are rocket thrusts. The goal is to get to the red circle in as little time. If you hit the wall or the sides, you start back at the green circle. Please forgive me masters of scratch (I know who you are – you find something to complain about in my program).