1 | Let MPGrav(i) return the acceleration of i'th particle which is specified by position X(i) and velocity V(i) |
2 | The kernel of algorithm increments X(i),V(i) from t to t+h using Runge-Kutta method. |
3 | This involves 4 function calls to MPGrav(i) for the four different choices of position and time needed in the Runge-Kutta method. |
4 | Let Xuse(i) be position vector used in each function call. Then we have |
5 | (time,Xuse) = (t,X) (t+h/2, X + (h/2)Dxa) (t+h/2, X + (h/2)Dxb) (t+h, X + hDxc) |
6 | where Dxa Dxb Dxc are shift vectors calculated by previous phase of Runge-Kutta method |