RK4 with adaptative step versus fourth order leapfrog integrator

  • I
  • Thread starter Dalor
  • Start date
  • Tags
    Rk4
In summary, the conversation discusses the speaker's efforts to solve the trajectory of a particle in a time independent field with the goal of minimizing error on the energy for a given calculation's time. They mention trying a 4th order leapfrog integrator, but it did not seem to be more efficient than the RK4 method. They also mention wanting to replace the RK4 integrator with a new one in the future. The conversation also touches on the use of symplectic integrators for long term simulations, but notes that adaptive step size is not in line with their approach. The speaker asks in which situations 4th order leapfrog integrators are better than RK4 and if they can be used with adaptive step size.
  • #1
Dalor
9
0
TL;DR Summary
I am trying to solve the trajectory of particle in a time independent field and I'm looking for the most efficient way, ie smallest error on the energy for a given calculation's time. I thought 4th order leapfrog integrator was better than RK4 but quick try does not seems to agree.
Summary: I am trying to solve the trajectory of particle in a time independent field and I'm looking for the most efficient way, ie smallest error on the energy for a given calculation's time. I thought 4th order leapfrog integrator was better than RK4 but quick try does not seems to agree.

(first thing : I don't know much about integrator)

I want to solve the trajectory of particle in a analytic field I know ( it is not possible to use symplectic method due to complicated evaluation such as elliptic integral etc. ). Right know I use a RK4 integrator with adaptative step ( the one in GEANT4). But from reading here and there I thought 4th order integrator could be better for energy conservation. So for testing, I try to solve simple system (particle in a 2D quadratic potential) in scilab with RK4 and 4th order leap frog integrator and the efficency (error versus solving time) was very close (with a small advantage for RK4 method). So it seems that there is not much difference between RK and leapfrog.
I have to add that trajectory i want to solve are not stable trajectory (they can but by accident) and maybe in this situation all integrator are more or less equivalent ?

So my question is : in which situation 4th order leapfrog integrators are better than RK4. Is this possible to use those with adaptative step ?

( I eventually wish to replace the RK4 adaptative step integrator of GEANT4 by a new one)
 
Last edited:
Physics news on Phys.org
  • #2
Dalor said:
Summary: I am trying to solve the trajectory of particle in a time independent field and I'm looking for the most efficient way, ie smallest error on the energy for a given calculation's time. I thought 4th order leapfrog integrator was better than RK4 but quick try does not seems to agree.

I have to add that trajectory i want to solve are not stable trajectory (they can but by accident) and maybe in this situation all integrator are more or less equivalent ?
Ah yes if unstable, all numerical integration will eventually fail unless you keep shortening the time step size toward zero.

Can you solve the differential equations to find a closed form time domain solution? If so, then just evaluate that solution instead of integrating. A site like Wolfram Alpha could help you find the solution.
 
  • #3
Dalor said:
So my question is : in which situation 4th order leapfrog integrators are better than RK4. Is this possible to use those with adaptative step ?
Symplectic integrators are most useful for long term simulations as they do not suffer from "energy drift" (a simplification, but it will have to do for now!). I use them for hamiltonian system simulations.

Unfortunately, adaptive step size is not really in the "spirit" of how symplectic integrators work. There have been many attempts in the literature, but as far as I have seen they all increase implementation complexity to a ridiculous level, and lose performance in the process.
 

What is RK4 with adaptative step?

RK4 with adaptative step is a numerical integration method used to solve ordinary differential equations. It is an improvement on the traditional fourth order Runge-Kutta method, where the step size is adjusted based on the error at each step to ensure accuracy.

What is the fourth order leapfrog integrator?

The fourth order leapfrog integrator is another numerical integration method used to solve ordinary differential equations. It uses a combination of forward and backward Euler steps to approximate the solution at each step.

Which method is more accurate?

It is difficult to say which method is more accurate as it depends on the specific problem being solved. In general, RK4 with adaptative step is considered more accurate as it can adjust the step size to minimize error, whereas the fourth order leapfrog integrator uses a fixed step size.

Which method is more efficient?

The efficiency of each method also depends on the specific problem being solved. In general, the fourth order leapfrog integrator is more efficient as it requires fewer function evaluations per step compared to RK4 with adaptative step. However, RK4 with adaptative step may be more efficient for problems with rapidly changing solutions.

When should I use RK4 with adaptative step versus fourth order leapfrog integrator?

It is recommended to use RK4 with adaptative step for problems where accuracy is crucial and the solution changes rapidly. On the other hand, the fourth order leapfrog integrator may be more suitable for problems where efficiency is the main concern and the solution changes gradually.

Similar threads

Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
14
Views
2K
  • Other Physics Topics
Replies
4
Views
2K
Replies
2
Views
3K
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
4K
  • Astronomy and Astrophysics
Replies
4
Views
1K
  • Programming and Computer Science
Replies
2
Views
4K
  • General Math
Replies
1
Views
2K
  • Programming and Computer Science
Replies
19
Views
17K
Back
Top