• Leonardo

Caudal 2: the four-body problem

When I initially developed Caudal I was thinking of giving it a name that resembles better the four pendula that it simulates. I'm glad I selected a name more inspired by the Chaos theory because the new model that I will add will fit very well.

Some weeks ago I was looking for a book to read. I like sci-fi. But its a genre that is often mixed with fantasy. Because of that, when I look for something to read I always end up finding young fantasy novels.

One novel that I have heard many good things of is the "Three-Body Problem" trilogy. The title is a reference to a classic problem in differential equations. That idea immediately clicked in my brain and I started making a model that I could implement in Caudal.

Cover of the Three-body problem book

The three-body problem refers to the interaction between three bodies (like planets) whose gravity affects the others. You can read more about it in the wikipedia page here. The model is easy to implement in a simulation software like Wolfram SystemModeler. Here's the whole code for the 2D case:

Modelica code of the Four-body problem implemented in Caudal 2.

After running several simulations I found that this would work, but there's a small problem. Sometimes when the planets are moving, one of them could be thrown away out of the galaxy because of the force that the other planets apply.

After a lot of calibration and testing different simulation methods, I got something that works. One constraint that I had to make is that my galaxy has hard walls. If a planet tries to escape, it will be repelled by the limits of the galaxy.

Here's a video that shows how it behaves:

In the video above, the code is running inside Caudal (1), but it will be available for Caudal 2 only.

I hope you like this new addition to the Mechanical Chaos Source.

P.S. I haven't read the Three-Body Problem book.

360 views0 comments

©2019 by Leonardo Laguna Ruiz - Vult DSP.