Among midpoint method, Heun's method and Ralston method, which method of solving ODE performs better in which case and why? Midpoint method, Heun's method and Ralston method- all are 2nd order Runge-Kutta methods. I know how these methods work. Are there some specific functions for which one of these methods performs better than the other two? If yes, what are those functions? And why do we see the difference in performance?
 A: For an autonomous ODE $y'=f(y)$, these all have the form 
$$
y_{n+1}=y_n+bhf(y_n)+(1-b)hf(y_n+ahf(y_n)).
$$
The Taylor expansion of that is
$$
y+hf(y)+a(1-b)h^2f'(y)f(y)+\frac12a^2(1-b)h^3f''(y)[f(y),f(y)]+...
$$
which compares to the Taylor expansion of the exact step at $y=y(x)=y_n$
$$
y(x+h)=y(x)+hf(y)+\frac12h^2f'(y)f(y)+\frac16h^3[f''(y)[f(y),f(y)]+f'(x)^2f(y)]
$$
One reads off the order condition $a(1-b)=\frac12$. Now if also $a^2(1-b)=\frac13$, that is, $a=\frac23$, that is, the Ralston method, then one term in the next higher derivative is the same in both expansions. As it is highly improbable that this second derivative term dominates for some significant time interval the other term containing only the first derivatives, this peculiarity will in general not improve the result.

Comparing these methods on a sufficiently non-linear ODE $y'(x)=p'(x)+10(\sin(p(x))-\sin(y(x))$ with $p(x)=\sin(x)$, $y(0)=p(0)$ gives the following error profile plots, where the graphs are of the global error over time, scaled by the associated step size power, $c^h_k=(y_k-p(x_k))/h^2$, $x_k=kh$.

As you can see, in the explicit methods the trapezoidal method = Heun's 2nd order method has a little less than twice the error as the midpoint method. Ralston's method is slightly better than the trapezoidal one.
