Use the RungeKutta Method of order 4 with h 025 to approxim
Use the Runge-Kutta Method of order 4 with h = 0.25 to approximate (to 6 decimal places) the solution of y\' = -2xy, y(0) = 3 on 0 lessthanorequalto x lessthanorequalto 1. Compare your approximations with the true values by calculating the errors at each step.
Solution
y\' = -2*x*y = f(x,y)
y(0) =yn = 3, xn = 0, h = 0.25
K1 = h*(xn ,yn ) = 0.25*(-2*0*3) = 0
K2 = h*(xn+(h/2) ,yn + (K1/2)) = 0.25*(-2*0.125*3) = -0.1875
K3 = h*(xn+(h/2) ,yn + (K2/2)) = 0.25*(-2*0.125*2.90625) = -0.18164
K4 = h*(xn+h ,yn + K1) = 0.25*(-2*0.25*2.81836) = -0.352295
y\' = y(0) + [(K1 +2*K2 +2*K3 +K4 )*h]/6 = 2.9545593
