Visualization of Third Order Runge-Kutta

numerical methodsrunge-kutta-methodsvisualization

I am struggling with where the slopes in third order Runge Kutta are evaluated and want to replicate a diagram I found for RK4 shown here: RK4 visualization

However, I am mainly struggling with how to visualize the K3 term in RK3. Any tips would be greatly appreciated!

RK3 is given by:
$$\dot y = f(t,y) $$
$$y_{n+1} = y_n + \frac{h}{6}(k_1 + 4k_2 + k_3)$$

where,
$$k_1 = f(t_n, y_n) $$
$$k_2 = f(t_n + \frac{h}{2}, y_n + \frac{h}{2}k_1) $$
$$k_3 = f(t_n + h, y_n + 2hk_2 – hk_1) $$

Best Answer

My attempt to reproduce the cited RK4 visualization looks like this RK4 visualization

The structurally similar Heun3 method can be given a similar visualization $$\begin{array}{ccc} \text{Heun3}&\qquad&\text{RK4}\\ \begin{array}{l|lll} 0&\\ \frac13&\frac13\\ \frac23&0&\frac23\\ \hline &\frac14&0&\frac34 \end{array} && \begin{array}{l|llll} 0&\\ \frac12&\frac12\\ \frac12&0&\frac12\\ 1&0&0&1\\ \hline &\frac16&\frac13&\frac13&\frac16 \end{array} \end{array} $$ Heun3 visualization

For the RK3 method one would have to make sense of the term $2k_2-k_1$. One possibility is to show it as zigzag path $(t,y)\to (t+h,y+hk_2)\to(t,y+h(k_2-k_1))\to (t+h,y+h(2k_2-k_1))$ so that each segment has a previously seen slope.

enter image description here