Thursday, February 8, 2018

Published February 08, 2018 by with 20 comments

N-Body Problem And Our Solar System

I was curious how stable our solar system is, so I started playing a bit with the n-body problem and here are some results. I've also included simple source code in MATLAB and Python if you want to play with it yourself.

Examples

Here is a gif showing roughly our current situation:



I set it so that each frame has the Sun at the center, and includes the Sun, Earth, Mars, and Jupiter over 36,500 days (~100 years) of orbit. I'll list all initial conditions at the end of the post. This is the track of each of them:



The first thing I wanted to find out is what happens if Jupiter is big. The result depends on exactly how big Jupiter is. My favorite occurs on this time scale when Jupiter's mass is roughly 1/4 of the sun's mass. The Sun and Jupiter trade Mars back and forth for a bit:




If Jupiter is big but not that big, everything is pretty stable on this time scale. For example, here are the results if Jupiter is 10 times as massive as it actually is:




We can do the same with Mars. If we increase the mass of Mars, things stay pretty stable until we get to 1/10 to 1/100 the mass of the Sun. We start seeing Earth's orbit fluctuating in distance from the Sun, and we can see Jupiter's orbit get more eccentric and Earth get thrown out of the solar system. Here are the results if Mars is ~80,000 times as massive as it actually is:




You can do a lot with these, and I've attached code to play with in both MATLAB and Python (I used MATLAB for these visualizations). Switching gears, another interesting phenomenon is Lagrange points. Of particular interest in our solar system are the L4 and L5 points. When you have two masses in orbit where one is <25 times as massive as the other, you get stable orbits for additional small masses at 60 degrees before and after the smaller mass on its same orbit. The most striking example are the Trojan asteroids for the Jupiter/Sun pair. I ran some examples of those also.


First, I moved Mars to be in Jupiter's orbit but at a 45 degree angle. That is, Mars is 1/8 of the orbit ahead of Jupiter. Here is a gif of the situation:



You can probably notice that the distance between Mars and Jupiter seems to fluctuate. If we plot the angle vs time, we can see that that's exactly what is happening:



It seems to bounce around 60 degrees or so. If it just starts at 60 degrees (L4), you get the following gif and angle vs time plot:




Little things lead to perturbations in the orbit. Here, there's the Earth that has a tiny effect. I also don't have exactly perfect initial conditions. The problem is also chaotic so the errors can blow up over time. Since this is a stable Lagrange point though, Mars will tend to move around that stable point as long as nothing really big perturbs it. I first encountered this midway through mechanics in college and remember it being really fascinating.

Anyway...that's it. If you want to see other simulations, feel free to edit the code posted below and/or ask me to run something.

code here

Background

The gravitational force between two masses is approximately G*m1*m2/r^2 where m1 and m2 are the masses and r is the distance between them. It is an attractive force so it pulls the masses together. When you have more than two objects, there is no general solution so you have to solve it numerically. Wikipedia has a good introduction to the problem.

There are a lot of paths to solve it. A very simple method is:
  • setup initial conditions
  • step forward a tiny amount of time
  • calculate the forces between all pairs of objects
  • approximate the solution to the equations of motion for each object using that force
  • repeat for the next time interval
I used that simple method here. For reference, the basic equations of motion are final position = initial position + velocity*(change in time) and final velocity = initial velocity + acceleration*(change in time).

Initial conditions

mass of sun = 2E30 kg
mass of earth = 6E24 kg
mass of mars = 6E23 kg
mass of jupiter = 2E27 kg
orbital distance of earth = 1 AU
orbital distance of mars = 1.52 AU
orbital distance of jupiter = 5.2 AU
orbital period of earth = 1 year
orbital period of mars = 1.88 years
orbital period of jupiter = 11.86 years




      edit

20 comments:

  1. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... Solceller med batteri

    ReplyDelete
  2. With the ability to mount over 100m off the ground, HOMMIIEE high mast lighting poles can take your project to new heights. high mast led flood light manfuacturers

    ReplyDelete
  3. The photons at that point move their capacity to electrons in the lower layer of the cell. Zonnepanelen

    ReplyDelete
  4. On the off chance that we set enough sun oriented boards in the Sahara desert to cover only one percent of it, we could create enough power to control the whole planet. Zonnepanelen kopen

    ReplyDelete
  5. Get huge discount on Home and Kitchen Appliances,Split and Window Air Conditioner, Mobiles & Laptops online , Television, Speakers & more electronics at best price.
    voltas refrigerator

    ReplyDelete
  6. We are also noticing that traditional medical doctors are also recognizing the increased interest in holistic healing and are finally starting to incorporate these healing methods into their practice to keep up with the current trends. There are many ways to obtain a construction job interview, but some are more effective than others. porno

    ReplyDelete
  7. I enjoy you because of all of your effort on this website.All of us hear all relating to the medium you give simple tips on your web blog.
    home automation service

    ReplyDelete
  8. This is the reason solar boards were created - to change over the sun's force into a structure we can utilize, similar to power. batteryless

    ReplyDelete
  9. The solar panels therefore maintain a clean setting and they leave the air fresh. More importantly they help in prevention of many cancer incidences. solar companies in Dallas Tx

    ReplyDelete
  10. Solar boards are comprised of solar cells. An individual solar cell can't deliver sufficient force for most purposes; accordingly, a few are participated in solar boards due to course, they make greater power together. Solar Energy Equipment Supplier

    ReplyDelete
  11. While the technology that goes into creating a solar panel is quite complicated, the concept is actually quite simple. Solar panels are made up of Texas, which are often made out of silicon. Other materials which can be used to construct solar cells are cadmium telluride and gallium arsenide.

    ReplyDelete
  12. While the technology that goes into creating a Hartford CT Solar Best Solar Inverters in Connecticut is quite complicated, the concept is actually quite simple. Solar panels are made up of solar cells, which are often made out of silicon. Other materials which can be used to construct solar cells are cadmium telluride and gallium arsenide.

    ReplyDelete
  13. Cheap Solar Springfield MA is one of the less explored forms of energy. As an attempt to solve energy crisis, many people think of trapping solar energy using solar panels. Cost effectiveness is the main attraction of solar energy consumption when compared to other options.

    ReplyDelete
  14. Have you been thinking about setting up solar panels for your home, but gotten discouraged because the Cheap Solar System cost happens to be too large? With the help of proper design and system sizing methods the cost of solar power systems will be considerably lowered. Additionally you can easily save in the vicinity of 40% on the cost of a solar power system by getting a kit and installing it yourself.

    ReplyDelete
  15. Affordable Solar Panels today is a great alternative and could save you money on your electric bills. Is this for you? Determine whether or not installing solar panels on your home is right for you.

    ReplyDelete
  16. I really loved reading your blog. It was very well authored and easy to understand. Unlike other blogs I have read which are really not that good.Thanks alot! solpaneler norrtälje

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. Solar company It's inspiring to see more homes and businesses adopting solar energy solutions.

    ReplyDelete