DEV Community

Cover image for Understanding the Universe through Code: Spiral galaxies
Jithin KS
Jithin KS

Posted on • Updated on

Understanding the Universe through Code: Spiral galaxies

Mathematical nature of our Universe

The Universe, from the tiniest to the largest scale that we have so far been capable of exploring, is mathematical in nature; and this has always fascinated me! It is because we could understand and exploit this, that we were able to develop technologies that would’ve been perceived to be nothing less than magic by our ancestors if they were here to see them. At present, using technology, we can communicate with our loved ones even on the other side of the globe at any time simply because our Universe obeys laws of quantum mechanics (We use transistors in our devices which were built by making use of laws of quantum mechanics) and we were lucky enough to understand the laws and use it to our advantage.

This means that if we are good at Mathematics, we can learn a lot about our Universe. Scientific geniuses who have come before us like Newton and Einstein made use of Mathematics to gain a very deep understanding of our Universe. But I think we are a bit luckier than people who lived before us because we are living in the age of computers. Computers help us do mathematics and calculations more easily and quickly which means we have an opportunity to understand the Universe better now.

About this series of blog posts

In this blog series, I'm going to make an attempt to take up some interesting observations in the Universe and make use of the power of simple math and coding to gain more insights into them using visualizations.

I'll be using a Javascript library called p5.js which is one of the easiest libraries to create visualizations on the web. If you want to get familiarized with p5, there is an amazing Youtube channel called coding train which will help you and you can also make use of their documentation.

I'll be explaining a topic through a sequence of 2 blog posts. In the first, I'll illustrate the idea using visualizations and in the second, I'll explain in detail how those visualizations are created.

Spiral arms of galaxies

Spiral galaxy

There won't be anybody who is not awestruck by the beauty of spiral galaxies. They are one of the most beautiful structures in the Universe that we have been able to observe. Today we are going to address the question of how galaxies get their beautiful spiral shape with the help of some simple simulations created using basic math and coding.

Unfortunately, even now, scientists don't fully understand how spiral galaxies get their shape. But some interesting theories have been developed to explain this out of which one of the most widely accepted is the Density wave theory.

According to this theory, the spiral arms of galaxies are the places where the density of the stars is relatively higher which is caused by gravitational effects within the galaxy.

Density wave theory

The Spiral arms can be modeled by using elliptical orbits that are tilted slightly as their radii grow as shown in the figure above.

I'm going to illustrate this idea using an app called Dynamic learning. Dynamic learning is an open-source project/platform which aims at improving Science and Math education with the use of interactive visualizations.

Open the Lesson in Dynamic learning ( please view in desktop)

Preview

I hope you got a basic idea of density wave theory and how it leads to the formation of spiral arms of galaxies.

In the next post, I'll get into the details of creating the visualizations itself !!!

Top comments (2)

Collapse
 
sanjayrjs16 profile image
Sanjay R

Great concept.

Collapse
 
sankarsanjay profile image
Sanjay Sankar

Found this really easy to comprehend. Looking forward for the upcoming posts!