I’m Back, and Multibody Motion

Well, I certainly didn’t mean to take such a long hiatus. And still nothing to profound to contribute. But just to prove I’m not dead, I’ve posted some playful work on using Mathematica to integrate the motion of many bodies with mutual gravitational influence. Certainly nothing novel, but if you wanted to solve for interesting multi-body dynamics in the Mathematica environment, I’ve written a fairly easy-to-use set of functions. See “Motion of Many Bodies Under Gravitational Forces” on the page http://alnaspaceprogram.org/bibliography.html.

The notebook includes some examples of Lagrange points and a demonstration with 7 bodies over a long simulation time. I had hoped to try some really complicated planetary systems, but it turns out that one needs some way to handle collisions. When two bodies pass very close to each other, the integration must reduce the time step size dramatically to maintain the error limits. This can effectively bring the simulation to a halt. A better approach would be to allow for a collision, with bodies merging. Because the notebook was a little side-study, I didn’t feel like getting into that level of coding. Besides, it’s been done other places.

The rest of this post is directed toward Mathematica programming, not space flight.

The notebook actually started as an investigation of using my own adaptive Runge Kutta integration code versus the built-in Mathematica NDSolve function for the numerical solution of differential equations. I thought I could write something more efficient for systems of equations expressed in vector form (honestly, at the beginning I didn’t thing NDSolve could handle vector systems). I turns out that NDSolve was faster, and certainly has better error handling than anything I was willing to write, so in the end I dropped my own integration scheme and just wrote some functions around NDSolve.

An annoyance with the notebook is a persistent problem with the animations not working when you first open the notebook in a fresh kernel. The SaveDefinitions option should force Mathematica so save all the definitions needed to run the animation, but it doesn’t appear to work. I’ve had problems with Manipulate and Animate not properly saving, and it’s always time consuming to figure out why. Again, not worth the effort to track down the problem for this particular study. Just evaluate the notebook to get all the animations to function.

Hopefully, I’ll get back to more regular posting. There are many new ideas to pursue, and lot’s of things I’ve left dangling.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>