I'd like to start analyzing some simple simulations. I'm a visual person, so I say we start graphing things. But what should we graph?
loop for every instant of time { loop for every object { 1. force = ... 2. dvel = force / mass * dt 3. velocity += dvel 4. dpos = velocity * dt 5. position += dpos } time += dt }
Well there's only a handful of piece of information in this loop.
Each object has a mass, but those don't change over the course of the simulation. Clearly, because the simulation loop from a couple slides ago doesn't have a line saying "mass += something".
The quantities that do change are time, the force being felt by each object, each object's position, and each object's velocity. So to start, I suggest that we just graph each of the major variables by every other major variable. There's only 4:
So after removing duplicates, that's just 6 graphs:
First up is force/time. Notice how, in all 3, the graphs for the left and right ball have perfect vertical symmetry. Hopefully that should make sense: at every timestep forces are always equal and opposite. At any given timestamp, whatever force the right object feels, the left feels but negative.
Another interesting difference between the graphs is that some are shifted to the left. The reason is because we represent mass with the radius of the balls in these simulations. So in the simulations where there is a larger ball, it has a larger radius, and so they end up colliding sooner. So this is kind of a silly difference.
A more interesting difference is that in some of the simulations the "base", the amount of the x-axis where the graph lifts off, is wider. We might talk about that later on.
Not much to say here, except notice the weird kind of diagonal almost-symmetry these graphs have.
We're going to be talking about this one extensively very soon, so I'll hold off on this one.
Again, we're going to be talking about this one very soon, so I'll hold off.
The only thing I wanted to say is to notice that in that last one, the graph doubles back on itself! The x-axis cooresponds to the balls' positions, and the balls can turn around and move backwards.
Again, not much to say, except cool symmetry.
Not much to say, except cool almost-symmetry.
Changelog:
© by Daniel Taylor