Description
The Runge-Kutta methods are generalizations of the Euler formula, where the slope is substituted with a weighted average of the slopes in [xn≤x≤xn+1]:
yn+1=yn+h(w1k1+w2k2+⋯+wmkm) The weights (wi) satisfy w1+w2+⋯+wm=1 and k1=f(xn,yn). The order of the method is m, if m=1, we get the Euler formula.
Second order
yn+1k1k2=yn+2h(k1+k2)where:=f(xn,yn)=f(xn+h,yn+hk1) Fourth order (RK4)
yn+1k1k2k3k4=yn+6h(k1+2k2+2k3+k4)where:=f(xn,yn)=f(xn+21h,yn+21hk1)=f(xn+21h,yn+21hk2)=f(xn+h,yn+hk3)