5. Example-2
Find y(0.5) for `y'=-2x-y`, `x_0=0, y_0=-1`, with step length 0.1 using Runge-Kutta 3 method (1st order derivative)
Solution: Given `y'=-2x-y, y(0)=-1, h=0.1, y(0.5)=?`
Third 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,y_0+2hk_2-hk_1)=f(0.1,-0.93)=0.73`
`y_1=y_0+h/6(k_1+4k_2+k_3)`
`y_1=-1+(0.1)/6[1+4(0.85)+(0.73)]`
`y_1=-0.9145`
`:.y(0.1)=-0.9145`
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.9145)=0.7145`
`k_2=f(x_1+h/2,y_1+(hk_1)/2)=f(0.15,-0.87878)=0.57877`
`k_3=f(x_1+h,y_1+2hk_2-hk_1)=f(0.2,-0.8702)=0.4702`
`y_2=y_1+h/6(k_1+4k_2+k_3)`
`y_2=-0.9145+(0.1)/6[0.7145+4(0.57877)+(0.4702)]`
`y_2=-0.85617`
`:.y(0.2)=-0.85617`
Again taking `(x_2,y_2)` in place of `(x_1,y_1)` and repeat the process
`k_1=f(x_2,y_2)=f(0.2,-0.85617)=0.45617`
`k_2=f(x_2+h/2,y_2+(hk_1)/2)=f(0.25,-0.83336)=0.33336`
`k_3=f(x_2+h,y_2+2hk_2-hk_1)=f(0.3,-0.83511)=0.23511`
`y_3=y_2+h/6(k_1+4k_2+k_3)`
`y_3=-0.85617+(0.1)/6[0.45617+4(0.33336)+(0.23511)]`
`y_3=-0.82242`
`:.y(0.3)=-0.82242`
Again taking `(x_3,y_3)` in place of `(x_2,y_2)` and repeat the process
`k_1=f(x_3,y_3)=f(0.3,-0.82242)=0.22242`
`k_2=f(x_3+h/2,y_3+(hk_1)/2)=f(0.35,-0.8113)=0.1113`
`k_3=f(x_3+h,y_3+2hk_2-hk_1)=f(0.4,-0.82241)=0.02241`
`y_4=y_3+h/6(k_1+4k_2+k_3)`
`y_4=-0.82242+(0.1)/6[0.22242+4(0.1113)+(0.02241)]`
`y_4=-0.81092`
`:.y(0.4)=-0.81092`
Again taking `(x_4,y_4)` in place of `(x_3,y_3)` and repeat the process
`k_1=f(x_4,y_4)=f(0.4,-0.81092)=0.01092`
`k_2=f(x_4+h/2,y_4+(hk_1)/2)=f(0.45,-0.81038)=-0.08962`
`k_3=f(x_4+h,y_4+2hk_2-hk_1)=f(0.5,-0.82994)=-0.17006`
`y_5=y_4+h/6(k_1+4k_2+k_3)`
`y_5=-0.81092+(0.1)/6[0.01092+4(-0.08962)+(-0.17006)]`
`y_5=-0.81955`
`:.y(0.5)=-0.81955`
`:.y(0.5)=-0.81955`
This material is intended as a summary. Use your textbook for detail explanation. Any bug, improvement, feedback then
|