Hi, is it possible to use a Runge-Kutta method (for example Euler's method to take one), and calculate more carefully depending on the behavior of a variable? For example, if one is to simulate a system of planets which attract each other according to the laws of physics, the calculations will have to be more carefully if there are two planets that are very close to each other, since every derivative will change more rapidly.

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...