Everything was great, but it just wasn’t a very exciting problem. The change in momentum of the spaceship was very small as it moved past the asteroid. Really, he could just have assumed a constant gravitational force and gotten pretty much the same answer. So, we came up with that astronaut scenario to spice things up a bit.

That introduced several challenging aspects: For one thing, since the asteroid is much smaller, it will also move. And how do you choose a good size for the time interval? Since both objects are at rest, they’ll be moving *verrry* slow at the outset. You can still calculate the changes with much smaller intervals, but that would take a lot of paper to solve. (Actually, you don’t have to use evenly spaced intervals, but let’s keep that constraint for fun.)

### OK, Computer

First, let me show you how *I’d* solve this problem with a simple Python script. We’ll start with the standard model for the magnitude of the gravitational force between any two objects:

In this expression, *m*_{1} and *m*_{2} are the masses of the two objects—let’s say the astronaut is 100 kg and the rock is 200 kg. Also, *r* is the distance between them (3 meters), and *G* is the gravitational constant, which has a value of 6.67 x 10^{–11} N×*m*^{2}/kg^{2}. First off, notice that *G* is a tiny number: 0.0000000000667. Which means the gravitational force between two objects is very small unless one of them is MASSIVE. So that’s not promising …

But let’s put the numerical calculation into a Python script. (Here’s the code.) I’m going to pick a time interval of 100 seconds and let stuff update until the center of the astronaut and rock are 0.5 meters apart—as a rough approximation of when they’ll make surface contact. I won’t show an animation of this, because it’s about as interesting as watching grass grow. But below is a plot of the position of both objects until they meet.