I’m building an $N$-body simulator, and I have everything ready to begin simulating. But my issue is is that I have no idea how to get all the starting positions and velocities for the celestial bodies in the Solar System, such as the planets and their moons. I suppose that if I knew their periods and their positions, I might be able to find out their velocities, but I don’t know how. Is there a source or database that can give me all this data?

Also, the point of this simulator is to simulate the trajectory of the Asteroid Apophis. If you know of any sources to find the data for its position and velocity vector, that would be very helpful. Otherwise, I’ll have to figure out some other way to find the velocity vectors/positions.


Before answering, please see our policy on resource recommendation questions. Please write substantial answers that detail the style, content, and prerequisites of the book, paper or other resource. Explain the nature of the resource so that readers can decide which one is best suited for them rather than relying on the opinions of others. Answers containing only a reference to a book or paper will be removed!

  • $\begingroup$ NASA has a wealth of information here. $\endgroup$ – HiddenBabel Jun 23 '18 at 22:59
  • $\begingroup$ @HiddenBabel You mean JPL has a wealth of information there. $\endgroup$ – JEB Jun 23 '18 at 23:13
  • $\begingroup$ @JEB ...JPL is currently owned by NASA... $\endgroup$ – Kyle Kanos Jul 5 '18 at 11:53


There is links for the planets, it is also in basic text/html which makes it good to automatically parse, don't know how often updated though?

Seems to have velocities and then mean elements to choose from, don't see Cartesian position though. But all info is there to constrain the positions to some accuracy.

The plain orbital elements give velocities if that's what you want. I personally deal with the mean orbital elements which basically just treat each planet as two body, averaging in perturbations and using least square to give average keplarian orbit. I assume this might not work for you, you could solve for mean velocity at any time as well as mean position, however this will have some error that is more than if you used the regular elements above the mean elements. I'm not clear how you would get an epoch and position from them though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.