- #1
CAF123
Gold Member
- 2,948
- 88
Homework Statement
I am creating an astrophysical simulation involving an arbritary number of particles and each particle is identified via a mass, label, position vector and velocity vector. I have made classes which can perform operations on these vectors and I also have a class which describes a particle in 3-D space (using this vector class).
With this, I have outlined an approach to calculate the force on some particle due to the others, the total energy of the system and methods to time-evolve the particle (LeapFrog algorithms). For the moment, we have to reduce the system to only 3 particles (Venus, Sun, Mercury) One of the questions was:
Count how many times each of the planets orbits the Sun during the simulation. First create an algorithm to test for a complete orbit. Do the two planets’ years have the correct ratio?
The Attempt at a Solution
So I need to find a way to test for a complete orbit. I understand this to mean that the particle passes the same point again. The number of orbits in the simulation will depend on the amount of time that the program is run for so I thought I could divide this by the period of the particle in question. I can't see how to do this because the path of the particle need not be circular and later we consider elliptical orbits anyway. A hint in the right direction would be great, thanks.