I have a numerical ODE simulation that I computed at fixed time step $h$ using a 4-th order Runge-Kutta method (RK4), producing a series of results $(x_1,y_1), (x_2,y_2), (x_3,y_3) \dots (x_N,y_N)$.

If I want to find an approximate solution $y$ at a location $x$ in between my intervals, I could use

  1. linear interpolation (just kidding, I wouldn't use this)
  2. cubic splines (current solution, whats my error estimate ?)
  3. a new RK4 step with $h=x-x_i$ (is error still $O(h^4)$ ?)
  4. some other appropriate method

What are the recommended methods for interpolating Runge-Kutta results and what is their error order?

  • $\begingroup$ The link provided by @J.M. eludes to the solution that to have the same order as the method additional function evaluations are needed. This is fine by me. $\endgroup$ May 24, 2013 at 12:36
  • $\begingroup$ Yes, and what you can do if you're willing to do more function evaluations (bootstrapping) is in that reference, too. $\endgroup$
    – J. M.
    May 24, 2013 at 12:47

2 Answers 2


You're asking how to produce dense output from your Runge-Kutta method. There are a number of ways to do this (see e.g. Hairer/Nørsett/Wanner). As noted in that reference, if you don't want to do more function evaluations aside from those already done by your fourth-order Runge-Kutta method, the best you can hope for is a third-order interpolant. This is fine, since it can also be shown that for a $p$-th order Runge-Kutta method, you can get by with dense output of order $p-1$.

The easiest third-order dense output you can construct is of course the cubic Hermite interpolant. Recall that given two function values and two derivative values, you can always build a unique cubic: the Hermite interpolant. Thus, you are guaranteed a $C^1$ interpolating function.

  • $\begingroup$ Yes, and this is what I am currently doing ( I called them cubic splines ) but it is the same thing. $\endgroup$ May 24, 2013 at 12:23
  • 1
    $\begingroup$ @ja, no, they're not splines. Cubic splines necessarily have $C^2$ continuity, which is not the case here. $\endgroup$
    – J. M.
    May 24, 2013 at 12:24
  • $\begingroup$ You are saying that cubic splines will deviate more from the dense output due to the additional constraints to reach $\boldsymbol{C}^2$ ? $\endgroup$ May 24, 2013 at 12:33
  • 4
    $\begingroup$ I didn't say that they'll deviate. What I said is that cubic splines and cubic Hermite interpolants are different; in particular, cubic splines are a special case of the cubic Hermite interpolants that have $C^2$ instead of just $C^1$ continuity. You don't need to build a spline; a simple Hermite interpolant should suffice. $\endgroup$
    – J. M.
    May 24, 2013 at 12:41

The RK4 method implicitly constructs a degree 3 polynomial interpolant, using the data $f(x_i)$, $f(x_{i+1})$, $f'(x_i)$, and $f'(x_{i+1})$ in each interval.

This interpolant can be constructed rather easily and efficiently using a linear combination of shifted Hermite basis functions in each interval.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.