# Solar System Simulation Part 2 Asteroids Teaser

Posted on

Solar System Simulation Series: Part 1 Part 2 Part 3

Too tired today to divulge into the details after coding for hours, but I’ve finally gotten the asteroid tossing code to work: Edit The post about the code and logic behind the asteroids is here!

Here is a screenshot after about 40000 iterations:

And one just after starting the program – as you can see, there’s an asteroid that used Jupiter and many more that used the Sun and Inner solar system as gravity slingshots!

Edit: And here’s another one where the asteroids ended up in more interesting locations by chance as well as giving it a few more iterations:

And here’s a video of the program in action to 3000 iterations:

At least it’s one thing off of my to do list!

To do list – stuff not implemented yet:

• Asteroids that are implied from the options panel, affected by the gravity of all the planets and the sun, with separate force vectors from each planet and sun to the tune of $F=\frac{Gm_{asteroid}m_{planetorsun}}{r^2}$ for each major body in the solar system. The next position of the asteroid can be implied by the sum of these vectors.
• Increase in orbital velocity as when orbital radius decreases (planets move faster during their closest approach and slower when farther away), instead of constant velocity. Can probably be done with a sinusoidal function of some sort.
• Make the Sun one of the foci of the elliptical orbits a lá Kepler’s Laws of Planetary Motion, instead of the center of the orbit. Can probably be done by shifting the orbit over by the difference between the planet’s perihelion (closest approach) and aphelion (furthest distance).
• The Sun isn’t stationary relative the the planets either! It is affected by the gravity of the planets in our solar system and moves over time, though such movement is relatively tiny (a few solar diameters/decade). Fun fact, this stellar movement is the “wobble” that astronomers use to detect some of the 1-2 thousand or so exoplanets (planets outside the solar system) they’ve found so far.
• Would require a lot of work, for very little noticeable change – these perturbations won’t be seen on the 1280×720 resolution picturebox that I’ve used. But, for the sake of accuracy, this is down the pipeline, though at the bottom.
• And a new goal: number of Earth days passed since the simulation started, this will be a little more complicated since now with the asteroid simulation, the number of iterations per second decreases as a function of the number of asteroids because of processing power limits.

I’ll get into the details of the code tomorrow!