Let's return to a familiar simulation.
I want to talk about its force/position graph.
So. First thing to notice is that they look symmetric. And they are!
Okay, so It's symmetric, big deal. Most of the graphs we've looked at for this particular simulation are symmetric. Also, one is positive while the other is negative, of course. And they attain the same max force at the same time, just with opposite signs.
Additionally, both graphs have the same "width" and the same "height." Well obviously they do, they're symmetric. But if you think about it, the "width" of the graph, the amount of the x-axis that isn't 0, is showing the distance each object travels during the collision. And both objects will travel the same distance during the collision. At the moment when their collision starts, they'll be barely touching, so their centers will be (left ball's radius) + (right ball's radius) away from each other. But at the moment when their collision ends, they'll be barely touching as well. So therefore, they'll both have traveled the same distance.
Let's make it more interesting. Here's another sim that we've seen before, the one where the left object has twice the mass.
Maybe you might have guessed it, but now the symmetry is broken. And because we want to have lots of tools for thinking about complex physics interactions, we're going to see if we can explain this, and maybe recover the symmetry like we did last time with velocity and momentum.
So one of them is now slanted more "away" than the other. And so you might think that we can do a similar thing to what we did with velocity. Maybe we can stretch or shrink one of these in the horizontal direction, somehow, dependent on mass?
This is made all the more complicated by the fact that the graphs can double back on themselves:
Unfortunately, that technique doesn't work here. No simple stretching scheme is going to help us. So what to do?
Well, okay, so I don't really know how to motivate this. I could dance around it for a while and try to connect a bunch of different ideas together to imply what we should try here. But I think that's probably just confusing, and that I should just give it to you straight.
The trick here is to look at these graphs like they're triangles. So they have a "width", and a height. And remember, their bottom edges are the same length, and their peaks are the same height. Now, if you remember your geometry, there aren't a ton of things you can say concretely about these triangles. Like, they don't share angles, or perimeters. BUT they do have the same area.
So here's an idea. What were to happen if we tried calculating the area of these graphs?
From top to bottom, the areas are (-0.500,0.500), (-0.888,0.888), (-0.444,0.444)
And if we do that, sure enough, the graphs' areas are exactly equal. Well, you know, equal and opposite. We're on to something here. Also, notice how these areas are, like, they're simple numbers. Like 0.5, and 2 and stuff.
... but what is that area? They're equal, sure, but what is that number? What I mean is, the area of these graphs are not going to be 1/2 * (distance traveled) * (max force). That was just a silly idea I threw out there to get us thinking in the right direction. But because the numbers we're seeing look pretty simple, maybe there's a simple expression for the area of the graphs that we can narrow in on.
Well, now that we have numbers that we can drive against, we can do some simulations. It might be tempting to look at the effects of mass first, but actually let's look at the effects of the initial velocity first.
From top to bottom, the areas are (-0.500,0.500), (-2.000,2.000), (-4.500,4.500), (-8.000,8.000)
Here, we have 4 simulations. In each, the left and right objects have the same mass, and the right object starts with 0 velocity, but the left object starts with different velocity in each.
And on the right are the graphs of their areas. Maybe it's hard to tell, but these numbers are scaling *quadratically*. 0.5 is half of 1^2, 2 is half of 2^2, 4.5 is half of 3^2, 8 is half of 4^2. So it looks like the graph areas scale quadratically with the initial velocity of the left ball. That's interesting.
Okay now let's try varying the masses. The right object has a velocity of 0 and a mass of 1. The left object has a velocity of +1, but different masses.
From top to bottom, the areas are (-0.500,0.500), (-0.889,0.889), (-1.125,1.125), (-1.280,1.280)
And when we look at the areas... huh. Okay that one's maybe not as obvious. Now we could run a bunch more simulations and graph the relationship, but I want to try something else first real quick.
In this one, the masses are matched for both objects:
From top to bottom, the areas are (-0.500,0.500), (-1.000,1.000), (-1.500,1.500), (-2.000,2.000)
Aaaaand... Okay, there we go, that's something. So it looks like the force/position graph areas scale linearly with mass, when both objects have the same mass.
Okay, I won't lead you on anymore. The issue with the middle set of graphs, the reason that it didn't scale linearly, is because when varying the left masses, another important quantity ended up inadvertently changing as well: the end velocities!
You can go do some simulations on your own if you want, to figure out the complete relationship between all of these variables, but I'll us all the trouble. The final relationship is:
So two things about this. First is that this is pretty different from the momentum derivation from last time. In the last chapter, each object has the same between any two points in time. Here, each object has the same differences in... well the quantity . So linear in mass, and also in this other weird term. And we don't know this for sure as of yet, but these quantities are only equal when the final and initial velocities are taken after and before the collision.
The other thing to note about this is... well, look at this form. If you remember your calculus, this should be screaming at you. But to be concrete, let's finally work it out from our simulation loop.
I'm going to be showing you why why the area of one of these graphs is equal to . I'll be doing so in 2 two steps. First, I'm going to rewrite the sum in terms of velocities, and then I'm going to show how the sum works out.
To calculate the graph's area, we're going to be taking its integral. We're going to be using the double-right-point-integral formulation that I introduced in the calculus chapter for this:
So. First off, force and dpos are both closely related to velocity. So maybe by re-writing each item of the sum in terms of velocities, we can simplify a bit.
Here I've pulled out, say, the k'th item of the integral we're dealing with. First, we can replace the force with mass * dvel / dt. Then we can replace dpos with velocity * dt. So with those two replacements, we see the sum is equal to the sums of mass * velocity * dvel.
Now we're going to do a little funny business to take advantage of the relationship between velocity and dvel:
So we do a bit of algebraic manipulation here. First multiplying and dividing by 2, then completing the square. But then notice that each .
This is a good form to end on, because after replacement a bunch of terms cancel out:
This is *almost* the form we saw earlier. But it has all of these terms as well.
We're going to be using another classic calculus trick here: we're going to say that these terms are "negligible", or that they "go to zero". Here's the intuition:
Say I reduced our simulation's dt by a factor of 10. We've seen that velocities converge closer to their "correct" value, and that the dvels all reduce by about a factor of 10. This means that each term will reduce by about a factor of 100. But by reducing the dt like this, it also mean that between any two points in time, there will be 10 times as many samples.
So for the sum of , we have 10 times as many samples, but each sample is about 100 times smaller. So the sum of all of these terms reduce by about a factor of 10.
The point here is that as you make dt smaller (to make the simulation more accurate), the sum of these terms rapidly become so close to zero that they aren't worth thinking about.
dt | ||
dt = 1 | 3.6328125 | 15.015625 |
dt = 1/4 | -0.49999976283355807 | 0.2084749852716972 |
dt = 1/16 | -0.4999999941855763 | 0.05052222607773189 |
dt = 1/32 | -0.4999999993182798 | 0.025224773497103642 |
dt = 1/128 | -0.49999999999729167 | 0.006303368328105668 |
dt = 1/512 | -0.4999999999999924 | 0.0015757979957734538 |
dt = 1/2048 | -0.5 | 3.939488101319231e-4 |
This table is based on the equal mass simulation that we've seen so many times already, but ran with different dt's.
The last thing to mention is the "T2+dt" bit. It's true that doesn't quite match the expression that we had before. Here we're going to make one more little approximation: if you reduce dt by a factor of 10, dvel will also shrink by about a factor of 10, and so is about equal to . This is an approximation that should be handled with care, but in this case it should be fine.
So to conclude, the sum of over every timestamp between times T1 and T2 converges to as we make our dt smaller.
This situation is starting to mirror the situation from last chapter. In the last chapter, we found out that mass * (final-velocity - initial-velocity) has an important symmetry property, and we used that to come up with mass * velocity as a quantity of interest. And now we have . So now we're going to name:
We can see above that the kinetic energy graphs are *not* symmetric, but by the end of the collision they do seem to end up balancing out.
But I still have to explain why that would be true. Because the difference of kinetic energies is the same as the integral of force/position, this is equivalent to asking why the force/position graphs would have equal and opposite area. It's certainly not obvious, at least not obvious to me, why these two graphs *should* be equal.
So we're going to try to show that the two force/position have equal and opposite areas. Last time, we saw that the sum of momentums are equal to 0 at every timestamp. But that won't work here. The areas are only equal when taken over the *entire* collision.
This time we're going to go with the right-point formulation of the kinetic energy sum. We're start by looking at each individual timestamp, and then see what happens.
So we have here our two force * dpos. The forces are equal and opposite.
This is interesting. is the difference between and . And due to commutativity, the sum of differences is the difference of sums:
That's the key to it, but there's another observation that we need to make first. That is, about the particular force that we've been using. Remember, it was itself a function of the distance between the two objects. So if we were to go out on a limb and assume that our collision function has to be a function of the difference in positions, we could re-write it like this.
So we have this nice, very suggestive form.
Now that we have this:
Since each of the ball's positions converge as dt goes to zero, goes to 0. We're also going to assume that the collision force is strong enough to stop objects from "phasing through" each other, so in other words never crosses 0. So this fulfills all of the requirements (listed in the calculus chapter) to call this an integral and apply tools from calculus.
We know, since this sum is an integral, it will have an antiderivative. We don't know what it is, and it can be very complicated to figure out its exact form. Err... well, we *do* know its antiderivative, it's the sum of the kinetic energy equations from before, one for each object! But expressing its antiderivative as a mathematical expression in terms of position would be very complicated.
But because we're able to write it this way, we do know that it does have an antiderivative that is a function *only of* . Just to give it a name, I'm going to call it graph_antiderivative().
But here's the trick! Remember from a couple minutes ago, when I was explaining that the base of the force/position graphs were the same width? I told you that, at the moment when the balls first touch, they'll be (left ball's radius + right ball's radius) apart, and at the moment they separate, they'll also be (left ball's radius + right ball's radius) apart. So if T1 and T2 are taken to be the very start and very end of the collision, and are the same! And so therefore, is going to be 0!
This also explains why the integrals are only equal for the *entire* collision: when T1 and T2 are taken to be some other range, and aren't equal, and so when you apply graph_antiderivative() to them and subtract, the value isn't guaranteed to be zero!
And if you extend T1 to be sometime before the start of the collision, well it's not feeling any forces, is it? So it adds 0 to the final result. Same with extending T2 to be sometime after the collision ends.
And there you have it. The sum of , taken between the moment the balls touch and the force/position graph rises above the x-axis, and the moment the separate and the force/position graph returns to the x-axis, is 0. The areas of the force/position graphs are equal and opposite.
This also means the sum of the kinetic energy of the two balls is conserved. That's because
, and so therefore, if T1 and T2 are taken before and after the collision, respectively,
Right. So. Now that we've got that out of the way, the last thing left to talk about is multiple objects. We know that the total kinetic energy of a simulation with two objects is the same before and after a collision. But what happens when three objects all interact at once?
Well, it goes pretty much the same. Here, we have 3 "force * dpos" terms, but the middle one's force equal and opposite to the sum of the forces on the left and right. So we can split them up and now both the left and right have a copy the dpos from the middle. And from here we just do it all again, getting "force * d(pos - pos)", it's just that each side has two separate versions of "pos - pos". Each side doesn't depend on the other. When we write the result of the sum using their antiderivatives, it's the same function, just two different "pos - pos"'s.
And that's that. When T1 is taken to be before all collisions begin, and T2 is taken to be after all collisions are finished, the sum is 0.
That was quite a lot. Let's regroup.
Similar to last time, the sum of over lots of timesteps heavily suggested a quantity we called kinetic energy, .
We saw there was a symmetry in the kinetic energy graphs. But instead of the symmetry occurring at every timestep like last time, the kinetic energy symmetry happens on the level of entire collisions. Or, in the case of 3 or more objects, groups of collisions.
The derivation of these facts required a number of assumptions. Namely:
The assumptions from calculus aren't up for debate, but we'll see in later lessons that if either of the other two assumptions are invalidated, kinetic energy isn't actually conserved.
So yeah. That's kinetic energy.
And hey, I think we've covered a lot of ground these last couple lessons. We started with the base rules of physics, the rules that describe the little micro-movements that happen to individual objects over micro-durations of time. We then derived from them some rules about the macro-movement of entire simulations over macro-durations of time. And I think that's kinda cool.
Changelog:
© by Daniel Taylor