This is a physics question, but the motivation for it comes from game design.

I want to simulate the motion of an object in 2D space with several point sources of gravity (actually stars). The point sources will not move, so the gravitational field is static. (I'm also ignoring any relativistic effects.)

I know I can get a pretty accurate trajectory just by applying an appropriate acceleration per tick, but I'm wondering if there's some way to generate the equation of motion for an object given the formula for its gravitational potential. That way to get the coordinates at a given time, I could get it by plugging the time into that equation. I know that the evolution of a system follows the path of least action, but I don't know how to go further than that.

I haven't found much on the internet for solving this particular problem. I'm wondering if:

A) There is no exact solution for any significant number of point sources (I already know this is true if the sources are moving in each other's fields);

B) There is an exact solution but evaluating it for a given instant is significantly more computationally expensive than finding the acceleration using the simple approach;

C) It's possible to get an arbitrarily good approximation using an iterative process, but it takes so long to converge that it's not worth it.

I'm probably going to go with the simple approach in the end (maybe with pre-calculating the acceleration as a vector field), but I'm curious to know what an action-integral–based solution would look like and whether a solution like that is at all practical to do in real-time.


1 Answer 1


the short answer:
I expect that the per tick acceleration approach is computationally the most efficient.


I expect that with multiple sources of gravity it is not possible at all to generate the equation of motion with the capability that you are looking for. Given the initial conditions the resultant trajectory may be one that intersects itself, possibly multiple times. It's difficult to see how to accommodate that.

(By contrast: in the case of a single source of gravity the spectrum of solutions is limited to a single class: conic sections: ellipse, parabola, hyperbola. That is what makes the problem tractable.)

You mention the notion that any path is one of least action.

To get a feel for how to apply least action in numerical computation of trajectories check out the material created by Edwin F. Taylor and Slavomir Tuleja,


In particular, Slavomir Tuleja has created Java applets that demonstrate the process that they refer to as 'hunting'. Given a starting location and an ending location you can find the trajectory using numerical computation. (Yeah, you have to know the ending location in advance so this form of numerical computation is for demonstration only, I don't see a practical application.)

The entire length of the trajectory is subdivided in sections small enough to get a good approximation of the actual trajectory. For simplicity of exposition I'll describe the case of subdividing in four sections. So that is five points in time: t0, t1, t2, t3, t4.
The iteration:
- adjust the location reached at t1 to make the action from t0 to t2 minimal.
- adjust the location reached at t2 to make the action from t1 to t3 minimal.
- adjust the location reached at t3 to make the action from t2 to t4 minimal.
Since the location reached at t2 has been adjusted the section from t0 to t2 is no longer minimal, so you iterate until the computation has converged to within your tolerance.

Anyway, this form of demonstrating least action physics is not relevant for you; to hunt for a trajectory you have to know the end point in advance.

In physics the least action approach is used analytically, to find an equation of motion. The least action approach is mathematically equivalent to the newtonian formulation, but the least action approach shifts the problem to the mathematical field of variational calculus.

I expect that with multiple sources of gravity the spectrum of possible trajectories is way too large to allow an analytical solution.

  • $\begingroup$ Thanks for the detailed answer and the link! It's much appreciated. I've had a fuzzy idea of how to make use of action ever since I read Einstein's Dice and Schrodinger's Cat so it's nice to see more clearly how it works and why it's not very useful as a practical tool. Thanks again! $\endgroup$ Oct 21, 2018 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.