OK, this is one of these things that looks easy, until you actually try it
Some comparisons. First, the Coelacanth-A method, which is described by Bob B. as:
vf = vo + ao * dt
df = do + vo * dt
The table shows the position of a particular trajectory 144 hours after launch.
Time step Distance to earth Distance to moon
1.0 sec 331955.4 km 88455.9 km
0.1 sec 400272.7 km 95209.0 km
0.01 sec 391201.0 km 95705.9 km
0.001 sec 390374.0 km 95771.5 km
0.0001 sec 390292.0 km 95778.2 km
As shown, the Coelacanth-A method really takes small time steps before it works well - even going from 1 ms to 0.1 ms makes a difference of almost 100 km in earth distance after 144 hours. Presumably, if the time step were small enough, we would run into the problem
cjameshuff describes, in which precision would be lost, and in the extreme case, the acceleration would round to zero when added to the velocity, and forecast trajectory would be a straight line. It is not obvious that anything like this is happening, because the results do seem to be converging, although I don't know any simple way to check that they are converging to the truth. Also, at least with my implementation and my computer, the 0.1 ms time step calculations are so slow they're painful.
The Coelacanth-B method is similar to the Coelacanth-A method, but includes an acceleration term in the distance update.
vf = v0 + a0 * dt
df = d0 + v0 * dt+a0*(dt*dt/2)
Same table for the Coelacanth-B method.
Time step Distance to earth Distance to moon
1.0 sec 479512.6 km 99207.1 km
0.1 sec 395052.5 km 95464.4 km
0.01 sec 390741.1 km 95743.7 km
0.001 sec 390328.5 km 95775.4 km
0.0001 sec 390292.0 km 95778.2 km
The two methods seem to agree rather closely at 0.1 ms time steps, but the Coelacanth-B method seems to get there faster than the Coelacanth-A method (which would be expected).
Then there is the Bob B. method.
af = ao
For i = 1 to x
vf = vo + (ao + af)/2 * dt
df = do + (vo + vf)/2 * dt
af = calculate updated value based on new position and time
Next i
The Bob B. method will be indexed by number to indicate the number of iterations. The Bob B.-1 method is equivalent to the Coelacanth-B method. The Bob B.-2 method results appear below. I didn't go to 0.1 ms, because it is so painfully slow, and the method appears to have converged sooner.
Time step Distance to earth Distance to moon
1.0 sec 390315.1 km 95776.2 km
0.1 sec 390283.2 km 95779.0 km
0.01 sec 390282.9 km 95779.0 km
0.001 sec 390282.9 km 95779.0 km
The Bob B.-3 method results appear below.
Time step Distance to earth Distance to moon
1.0 sec 390315.1 km 95776.2 km
0.1 sec 390283.2 km 95779.0 km
0.01 sec 390282.9 km 95779.0 km
0.001 sec 390282.9 km 95779.0 km
The Bob B.-4 method results appear below.
Time step Distance to earth Distance to moon
1.0 sec 390315.1 km 95776.2 km
0.1 sec 390283.2 km 95779.0 km
0.01 sec 390282.9 km 95779.0 km
0.001 sec 390282.9 km 95779.0 km
So, at least for this trajectory, the Bob B.-N method appears to strongly outperform the Coelacanth-B method for N>1, but there is little to no additional benefit for taking N>2.
Future possible improvements:
a) Make the time step depend on the spacecraft velocity and curvature of the gravitational field. Based on my suspicion that most of the approximation error takes place while close to earth and close to the moon, but this is as yet unconfirmed.
b) Create a dynamic Bob B. method, in which the number of iterations is variable, depending on how much the spacecraft position and velocity are changing with each iteration. However, if the trajectory tried here is typical, there would be little incremental benefit to more than two iterations, so it is not obvious that there is much benefit to be had from this strategy.
c) Use totally different methods, like those suggested by
cjameshuff.
The idea that any old algorithm can be used, and the approximation error overcome by brute computing force, does not seem to have been confirmed here.