Find y(0.5) for `y'=-2x-y`, `x_0=0, y_0=-1`, with step length 0.1 using Runge-Kutta 4 method (1st order derivative) Solution:Given `y'=-2x-y, y(0)=-1, h=0.1, y(0.5)=?`
Forth order R-K method
`k_1=f(x_0,y_0)=f(0,-1)=1`
`k_2=f(x_0+h/2,y_0+(hk_1)/2)=f(0.05,-0.95)=0.85`
`k_3=f(x_0+h/2,y_0+(hk_2)/2)=f(0.05,-0.9575)=0.8575`
`k_4=f(x_0+h,y_0+hk_3)=f(0.1,-0.91425)=0.71425`
`y_1=y_0+h/6(k_1+2k_2+2k_3+k_4)`
`y_1=-1+0.1/6[1+2(0.85)+2(0.8575)+(0.71425)]`
`y_1=-0.91451`
`:.y(0.1)=-0.91451`
Again taking `(x_1,y_1)` in place of `(x_0,y_0)` and repeat the process
`k_1=f(x_1,y_1)=f(0.1,-0.91451)=0.71451`
`k_2=f(x_1+h/2,y_1+(hk_1)/2)=f(0.15,-0.87879)=0.57879`
`k_3=f(x_1+h/2,y_1+(hk_2)/2)=f(0.15,-0.88557)=0.58557`
`k_4=f(x_1+h,y_1+hk_3)=f(0.2,-0.85596)=0.45596`
`y_2=y_1+h/6(k_1+2k_2+2k_3+k_4)`
`y_2=-0.91451+0.1/6[0.71451+2(0.57879)+2(0.58557)+(0.45596)]`
`y_2=-0.85619`
`:.y(0.2)=-0.85619`
Again taking `(x_2,y_2)` in place of `(x_0,y_0)` and repeat the process
`k_1=f(x_2,y_2)=f(0.2,-0.85619)=0.45619`
`k_2=f(x_2+h/2,y_2+(hk_1)/2)=f(0.25,-0.83338)=0.33338`
`k_3=f(x_2+h/2,y_2+(hk_2)/2)=f(0.25,-0.83952)=0.33952`
`k_4=f(x_2+h,y_2+hk_3)=f(0.3,-0.82224)=0.22224`
`y_3=y_2+h/6(k_1+2k_2+2k_3+k_4)`
`y_3=-0.85619+0.1/6[0.45619+2(0.33338)+2(0.33952)+(0.22224)]`
`y_3=-0.82246`
`:.y(0.3)=-0.82246`
Again taking `(x_3,y_3)` in place of `(x_0,y_0)` and repeat the process
`k_1=f(x_3,y_3)=f(0.3,-0.82246)=0.22246`
`k_2=f(x_3+h/2,y_3+(hk_1)/2)=f(0.35,-0.81133)=0.11133`
`k_3=f(x_3+h/2,y_3+(hk_2)/2)=f(0.35,-0.81689)=0.11689`
`k_4=f(x_3+h,y_3+hk_3)=f(0.4,-0.81077)=0.01077`
`y_4=y_3+h/6(k_1+2k_2+2k_3+k_4)`
`y_4=-0.82246+0.1/6[0.22246+2(0.11133)+2(0.11689)+(0.01077)]`
`y_4=-0.81096`
`:.y(0.4)=-0.81096`
Again taking `(x_4,y_4)` in place of `(x_0,y_0)` and repeat the process
`k_1=f(x_4,y_4)=f(0.4,-0.81096)=0.01096`
`k_2=f(x_4+h/2,y_4+(hk_1)/2)=f(0.45,-0.81041)=-0.08959`
`k_3=f(x_4+h/2,y_4+(hk_2)/2)=f(0.45,-0.81544)=-0.08456`
`k_4=f(x_4+h,y_4+hk_3)=f(0.5,-0.81942)=-0.18058`
`y_5=y_4+h/6(k_1+2k_2+2k_3+k_4)`
`y_5=-0.81096+0.1/6[0.01096+2(-0.08959)+2(-0.08456)+(-0.18058)]`
`y_5=-0.81959`
`:.y(0.5)=-0.81959`
`:.y(0.5)=-0.81959`
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then