I have a made a fully functional n-body simulation for a project in high school, written in Java. Right now, to "simulate" the solar system, I am simply spawning the different bodies at their respective distance from the sun with an initial velocity calculated by v = sqrt(G*M/r), as shown in the picture: http://i.imgur.com/aJYLwRM.png where the earth is blue, mars is green and jupiter is red. However, after a while, these bodies travel outwards and soon leave the screen (still maintaining an orbit, the radius of the orbit is just increasing.). Now I am wondering, is this bound to happen using newtons simplified formulas, or is it my program that is not functioning properly? Could it be that the orbits should not be exactly circular? And another question: how can I use my simulation to actually simulate the orbits of the planets in ellipses? I have been trying to figure out a smart way to spawn the bodies, but I haven't been successful. Any ideas? And sorry if this thread is in the wrong section, didn't really know where to put it.