Hello. I'm working with Newton's Law of Universal Gravitation which has the equation:


Now, when you solve this for acceleration you get...


which, and correct me if I'm wrong anywhere along the way here, is describing acceleration as a function of distance.

Now, I want to integrate this function along a time so that I may effectively describe where the object is at any given moment having been given this equation, a mass of the body whose gravity is attracting it, and starting distance and velocity.

I've been able to do so using a simple step-method where I am just calculating the acceleration at the beginning of my step, using it as a 'constant' for the entire step with constant acceleration equations to describe the movement, and then recalculating the new 'initial' speed using the old speed + my constant acceleration times the timestep and calculating my new acceleration based off of the new distance from the 'center'.

This method works, but in order to increase accuracy I've been trying to fathom how to incorporate Runge-Kutta into the problem... but is this possible?

Runge-Kutta requires ordinary differential equations, but I'm not sure my equation falls in that category as it effectively is yielding a number in "distance per time" but is a function of distance, not time... can anyone help clarify this for me if I am wrong, or confirm for me that Runge-Kutta is, infact, inapplicable as I've come to think?