Now, I know that this can be solved using variable step length. However, calculating planets' orbits around each other in a computer program charges the processor heavily - calculating every planet's orbit more carefully by reducing the step length will slow down the whole process and make the program lag. In contrary, running the simulation with the same step length as before will really decrease the accuracy of the orbits of the two planets that are close to each other.

Ideally, only the orbits of the two planets that are close to each other would have to be calculated more carefully, maybe by reducing the step length for only those planets in, if it in some way is possible. Do you know of any way to do this, or if it the method is used in applications? Is there some other way to increase the accuracy when calculating the orbits for only those two planets? It's easy when all variables in a differential equation have the same step length. But when They get different step length, it gets more complicated... (Doh)