How do I calculate the motion of 2 massive bodies in space?
- by 1224
I'm writing code simulating the 2-dimensional motion of two massive bodies with gravitational fields.
The bodies' masses are known and I have a gravitational force equation.
I know from that force I can get a differential equation for coordinates.
I know that I once I solve this equation I will get the coordinates.
I will need to make up some initial position and some initial velocity.
I'd like to end up with a numeric solver for the ordinal differential equation for coordinates to get the formulas that I can write in code. Could someone break down how from laws and initial conditions we get to the formulas that calculate x and y at time t?