I am working on java applications for interaction between objects. Fortrying to understand how to calculate the space objects (sun, planets and their moons)orbits of solar system bodies in an n-body framework, it worksbased on the pair-wise gravitational attractioninteraction between themthe objects. At present, I am considering 44 objects (sun, planets, major moons and major asteroids).
Say I startam starting with Positionthe state vectors (position and velocity vectors) of each of the objects with Sun as centre obtained from telnet ssd.jpl.nasa.gov 6775
(JPL Horizons). as on 01/-Jan/-2017 at 00:00h. Let00 UTC and would like to let the objects interact with each othersystem evolve for 4344h (i.e till 01/07/, 01-July-2017 at 00:00h).
BasicallyI have written a program to do this in Java, and so far the results do not seem to be even reasonably close to what they should be, comparing with the state vectors obtained from Horizons. After every 2 second time step, the net gravitational force inforces on each objectbody from all of the others is calculated, and thethen in one shot update all the velocities and positions caused byare updated based on the resultant acceleration of each objectaccelerations from those net forces. Then I compare the final updated position vectors from the application with data obtained from Horizons after correcting for the Sun's updated position.
In my application, I am not differentiating between the Sun, planets and moons an still, so I am not sure why should there should be so much more error for the moons? I. I have tried even smaller calculations steps (e.g.decreasing the step size, from 2 seconds down to 0.25 seconds), still nobut there is not significant improvement.
I know, it is difficult to comment without looking atWhat might be the actual code.
I just want to know as to whether I am missing out on something.problems that I even tried to introduce a time delay for the gravitational force based on distance with noshould investigate here? Are there things that clearly need improvement (Laterright away? Or perhaps there are tests I read -without understanding - thatcan to do help diagagnose the speedprimary sources of gravity does not matter in such calculations!).error?
EDIT:
Here is the gist of the calculation method as requested in comments: