2 edited tags
1

# Finding the initial velocity vector of an orbiting body

I'm writing a program that simulates Newton's law of universal gravitation by simply calculating the force and applying it on the objects. The simulation works very well, but now I want to simulate real systems using real data. I looked all over for how to find the initial conditions such as the initial velocity and initial position, but I can't find anything.

I'll make it clear by taking the Earth as an example as in the figure below. How do I calculate w (green vector)? If I want to set up the system and simulate it, what would the Earth's initial velocity be so that it orbits the sun at a period of 365 days? And what would its respective position be? I know the orbital speeds of the Earth and the Moon, but they are obviously not the initial velocities of the bodies in the system.

I played around with the values and got something around 30 km/s, but now the Earth's gravity can't pull the moon along the orbit path because it's too fast, even at extremely small time steps. I can give them similar velocities that is enough to drag the moon along, but then the moon's orbit period becomes less than 27 days. 