# Comparing Leapfrog Methods with Other Numerical Methods for Differential Equations

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

This Demonstration shows the exact and the numerical solution of some ODEs using a variety of numerical methods. Four of these methods are well-known simple standard methods. Additional methods are the well-known leapfrog method and the less-known asynchronous leapfrog method. Further, a straightforward derivative of each of these two methods is considered. Use the dropdown menus to vary the differential equation and the method. Use the sliders to vary the initial value or to change the number and size of the integration steps.

Contributed by: Ulrich Mutze (March 2011)
Open content licensed under CC BY-NC-SA

## Details

In comparing the performance of numerical methods for differential equations, one has to take into account the computational complexity of the underlying algorithms. A simple measure (and for many practical applications the most relevant one) counts how often the right-hand side of the differential equation has to be evaluated in one integration step. The leapfrog and asynchronous leapfrog methods excel in needing only one such evaluation and thus compare directly only with the explicit Euler method, which they outperform in a spectacular way. Since the leapfrog methods are second-order methods, they are most naturally compared with the second-order Runge–Kutta method, which is also known as Heun's method. Since Heun's method does two right-hand side evaluations, it is fair to compare one Heun step with a composition of two leapfrog steps of half the step size. To allow such a fair comparison without having to change the step size, such combined half-steps are implemented. They are referred to as densified methods.

Snapshots 1 and 2: behavior for a stiff differential equation; here, the Runge–Kutta methods are superior to the leapfrog methods

Snapshots 3 and 4: behavior for non-stiff differential equations; the densified asynchronous leapfrog method seems to be in most cases more accurate than Heun's method

The leapfrog methods were added by the present author to a program by Edda Eich-Soellner (see Related Links). Apart from additions, virtually no changes have been made to the program of this instructive Demonstration.

References

[1] U. Mutze. "An Asynchronous Leap-Frog Method." (2008) http://www.ma.utexas.edu/mp_arc/c/08/08-197.pdf.

[2] Alternate link for [1]: http://www.ulrichmutze.de/articles/leapfrog4.pdf.

## Permanent Citation

Ulrich Mutze

 Feedback (field required) Email (field required) Name Occupation Organization Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback. Send