Gaining Understanding Orbital Dynamics & N-Body Simulation

AI Thread Summary
The discussion focuses on a high school student's project to understand orbital dynamics and create an n-body simulation. Participants confirm that simulating a few bodies is feasible with basic knowledge of classical mechanics and programming, suggesting that it may take only a few hours if the student is familiar with numerical programming. However, they caution that n-body simulations become complex and chaotic as the number of bodies increases, requiring careful numerical integration techniques to maintain accuracy. Recommended methods include direct summation for simplicity and the leapfrog method for its conservation properties, while more advanced techniques like Runge-Kutta and oct-tree methods are noted for larger simulations. Overall, the project is deemed achievable with the right resources and learning approach.
Arcthor
Messages
34
Reaction score
1
Hello.

I have a project in school in which I will be attempting to gain an increased understanding of orbital dynamics and the maths related to it and using this information to create a n-body simulation. I have a like 3-4 months to finish it and I'm currently in high school so I am only familiar with classical mechanics and related math. I currently know some Java and have a basic understanding of how gravity works in Newtonian physics. However, I am prepared to learn as much as possible, especially if it's about math.

Any tips or information regarding orbital dynamics and the n-body problem would be greatly appreciated.

I don't really know how hard this project will be. Am I in over my head? Is is even possible to simulate the solar system or even 2 or 3 bodies orbiting each other with my knowledge?
 
Physics news on Phys.org
Arcthor said:
Is is even possible to simulate the solar system or even 2 or 3 bodies orbiting each other with my knowledge?
Yes. You will find tons of source code examples for this on the net. It's more like 3-4 hours, than 3-4 months. So don't worry.
 
A.T. said:
Yes. You will find tons of source code examples for this on the net. It's more like 3-4 hours, than 3-4 months. So don't worry.

Oh, really? Nice. It seems easy on one hand, but I've also read that it is extremely hard to do a n-body simulation with more than 3 bodies due to the fact that the motions become so random, sort of like a double pendulum. https://math.uwaterloo.ca/applied-m...ed-mathematics/files/uploads/images/dpend.gif

Do you know if there is any truth to this or why people seem to think this is the case?
 
Arcthor said:
Do you know if there is any truth to this or why people seem to think this is the case?
Yes it's potentially a chaotic system. And numerical integration tends to accumulate errors over time, so you have to continuously correct them based on conservation laws, if your really want a long term prediction.
 
You can play Kerbal Space Program to get an intuitive understanding of orbits. (Un?)fortunately it doesn't simulate n-body orbits, but once you get the general idea of 2-body orbits, n-body orbits are just details :D
 
Well, it's 3-4 hours if you know numerical programming. If you don't know programming and you don't know numerical integration techniques, then it will take much longer.

Don't just copy some open source program.. you won't learn much that way. I think the preferred integration method for gravitational systems is the leapfrog method https://en.wikipedia.org/wiki/Leapfrog_integration
 
Khashishi said:
I think the preferred integration method for gravitational systems is the leapfrog method https://en.wikipedia.org/wiki/Leapfrog_integration

I prefer the Runge-Kutta Nyström algorithm [e.g. http://theory.gsi.de/~vanhees/faq/gravitation/node62.html ]. It's not as easy to implement but much more accurate.
 
Runge-Kutta is easy to implement with standard libraries. There's no real need to write numerical integration methods from scratch, since people who are better than you at doing so have already spent a lot of time perfecting them.
 
  • #10
dipole said:
Runge-Kutta is easy to implement with standard libraries. There's no real need to write numerical integration methods from scratch, since people who are better than you at doing so have already spent a lot of time perfecting them.
Students do stuff to learn, not because there is a need.
 
  • #11
Yes, but he wants to learn about orbital mechanics, not the details of efficient numerical integration... Obviously I'm not saying he shouldn't try to learn it, but in practice no one writes their own numerical methods, because a lot of time and energy has already been spent making very good ones that are general.
 
  • #12
dipole said:
Yes, but he wants to learn about orbital mechanics

"... and the maths related to it and using this information to create a n-body simulation"
 
  • #13
A simple n-body simulation should be easy to write if you have high school physics and some programming experience! The simplest way is to do direct summation, where you calculate GMm/r^2 for all pairs of bodies at each time step and sum the forces on each particle. As others have pointed out, the leapfrog method is the most common method for updating the positions and the velocities. A few other things that you might want to consider:

  • Direct summation scales as n^2, since each body interacts with n other bodies, and you need to calculate all interactions for each of n bodies. In computer algorithm lingo, it is O(n^2). This makes it less practical when n is very large (> 1000, say)
  • There are more complicated schemes for n-body simulations such as oct-tree, particle-mesh, and particle-particle-particle mesh (PPPM, or P^3 M) methods. These are harder to implement but have O(n log(n)) scaling which makes them more efficient for large simulations.
  • Leapfrog is not the most accurate numerical integration scheme, but it has nice energy/momentum conservation properties and is time reversible. This is why it is more common for n-body than RK4.
 
Back
Top