
Do you know why the earth is shaped like a globe? So you can kick it and it will roll away! From the moment you wake up in the morning you are always with people and your mind is caught up in worldly thoughts. So sometime during the day, sit for a few minutes, get into the cave of your heart, eyes closed, and kick the world away like a ball. –Sri Sri Ravishankar
Apart from this ethereal answer, let’s see if deep learning has an answer to this question. Almost all of the deep learning and Artificial Intelligence is about solving complex optimization problems where the objective to be optimized is a function of multiple parameters and sometimes those parameters range in millions or billions. GPT-3 has 175 billion parameters! Do not worry, physics problems need only a few hundred (not very deep actually!)
You must be wondering what is the connection between physics and deep learning, I was too, then I realized that all the laws of nature can be reformulated as solutions to optimization problems. I am starting a series of posts where I will take up a physics problem and solve it using Pytorch’s amazing abilities of automatic differentiation and optimization.
Now moving to our original question, why are planets and stars spherical? If we consider them as static systems, neglecting their spin around their axis and their path through space-time, laws of Physics (Principle of least action) tell us that such a stationary system would have settled to a state of lowest potential energy. In the case of a heavenly body like earth, potential energy is the self gravitational potential energy. It is the force of gravity that holds the planet together and the rigidity of its constituent materials that prevents it from collapsing into itself.
But why does the force of gravity have to shape the planet into a sphere, why not into a cube or a doughnut? It looks like the spherical shape has the least potential energy. Let’s try an experiment where I take some particles, throw them randomly into 2D space, and then optimize the gravitational potential energy. I add some rigidity to these particles so as to prevent these particles from collapsing into each other. Rigidity is added by adding a term to the potential energy which is proportional to the square of overlap between particles(similar to a spring’s potential energy).
Loss function, in this case, is a sum of gravitational potential energy between each pair of particles and potential energy due to the elasticity of particles that are in contact with each other.
Below are some animations that show the result of these experiments where I take 1000 particles of varying sizes and varying initial positions and optimize their coordinates to take the loss to its lowest value. There are a total of 2000 parameters to optimize. All these are just scatter-plots in matplotlib where points smash into each other!!




The final shape we should get is a circle, the shapes from the above experiments are tending towards a circle but not exactly circles because that would need finer particles and more iterations. The shapes currently are stuck in a local minima and they can approach a perfect circle with slight perturbations. But the results are still amazing with just a few lines of python (Pytorch) code! You can find those lines here in this colab notebook. I hope you now know why planets are round! Watch out for the next post. Read more blogs here.