Runge kutta method for order 4 for ODE x'=f(t)

Question: What is the simplified form of Runge kutta method when applied to order 4 for ODE x'=f(t)?

The runge kutta method is

$$k_1 = f(t_0,x(t_0))$$ $$k_2 = f(t_0+h/2,x(t_0)+k_1/2)$$ $$k_3 = f(t_0+h/2,x(t_0)hk_2/2)$$ $$k_4 = f(t_0+h,x(t_0)+k_3)$$ Then $$x(t_0+h)= x(t_0) + h\frac{k_1+2k_2+2k_3+k_4}{6}$$

How would I apply it to the ODE here? DO i expand taylor series like expand $x(t_0+h)= x(t_0) + h\frac{k_1+2k_2+2k_3+k_4}{6}$? thanks.

• first line i added question: to make it more obvious – james black Mar 21 '18 at 15:09
• When $f$ is independent of $x$, it becomes the Simpson's 1/3 rule. I don't think you need to, or am able to simplify it further if you want to keep it as 4-th order. Because Simpson's 1/3 rule is already one of the simplest 4-th order integration method. Of course that depends on your definition of "simple". – velut luna Mar 21 '18 at 15:22
• I don't get your question. The method described in your question is explicit. So you can evaluate $k_i$ and the plug it into $k_{i+1}$ to evaluate $k_{i+1}$. What do you exactly mean with "apply" it to the ODE? At what point are you stuck? Is velut's comment what you are looking for? – P. Siehr Mar 21 '18 at 15:43

You just follow the equations. You start at a time $t_0$, a position $x_0(t_0)$, and choose a step size $h$. You now just compute each line in turn. When you are done you are at time $t_1=t_0+h$ and (an approximation of) position $x_1(t_1)$. Now take another step which might be at the same step size or not. There is a nice discussion of how to choose the step size based on the desired error in section 17.2 of Numerical Recipes. Other numerical analysis texts should have a section as well.