Simulating Galaxy Collisions With Arduino
by stoppi71 in Circuits > Arduino
70 Views, 2 Favorites, 0 Comments
Simulating Galaxy Collisions With Arduino



Astronomy has always fascinated me. In the 1980s, around the age of 16, I regularly bought the magazine Astronomy. One of the issues covered the simulation of galaxy collisions. I was immediately intrigued by the article and tried out the provided code right away. I wondered how such a short code could simulate the complex motions of stars. At that time, I didn't yet understand the physical background. Later, with the knowledge of Newton's equation of motion F = m*a and the simple, iterative Euler-solution of differential equations, the fog cleared, and I began to understand simulation. Interactions between galaxies can be observed very well with a telescope. A famous example is M51, the Whirlpool Galaxy. Here, two nearby galaxies interact. I wrote the original computer program in BASIC. The current implementation was done with an Arduino in C++.
Supplies





For this science project you need just an Arduino Due and a 320x480 pixel display you can plug on the Arduino Due. For the input you need 5 resistors, 5 push buttons and 1 potentiometer, that's all.
With the 5 push buttons you change the zoom, the time-step and one button is for continue in the menu. With the potentiometer you can input the number of stars and their mass.
The Mathematical Background



The individual stars and black holes interact via their gravitational force. Newton's law of gravity describes the force F between the two masses m and M at a distance r. According to Newton's equation of motion F = m*a, this force F leads to an acceleration a of the masses. However, the acceleration a is equal to the change in speed per second.
The change in speed delta_v is therefore: delta_v = v_after - v_before = a * delta_t with the time step delta_t. If we know the current acceleration a and the previous speed v_before, we can easily determine the speed after the time step v_after. The relationship v = delta_s / delta_t = (s_after - s_before) / delta_t applies to the speed v.
If we know the position before the time step s_before and the current speed v, the position after the time step s_after can be calculated. To increase the accuracy of the calculation, the velocity v is taken as the average of the velocity before and after the time step, i.e., v = 1/2 * (v_before + v_after).
Thus, using this Euler method, we have calculated the positions after the time step. Using these new positions, we again determine the force F using the law of gravity, and then subsequently determine a_after, v_after, and s_after.
If you have, say, 100 stars in the simulation, each star exerts a force F on the others. So, you have to calculate (100 2) = 100! / (98! * 2!) = 100 * 99 / 2 = 4950 interactions. That's quite a lot... The force from star 36 on star 58 is the same as the force from star 58 on star 36. Therefore, the binomial coefficient (100 2) is sufficient.
Black Hole Vs. Galaxy











With the first Arduino-sketch you can simulate the gravitational interaction between an intruder-black hole and a galaxy.
Galaxy Vs. Galaxy



With the second sketch you are able to simulate the interaction between two galaxies like M51...
Videos

With this "simple" arduino sketch you're now able to simulate galactic collisions and compare it with real results in the night sky. Nearly 40 years after I got in contact with this type of simulation you can be fascinated like I was back in time. If you are interested in further physics projects, here is my Youtube-channel and homepage:
In this sense Eureka and stay curious