Reduce y''−sin y=0 to a first-order system and approximate y(3) with two Euler steps and one vector RK4 step.
Reduction to a system
Consider y′′−siny=0 with y(1)=2 and y′(1)=0, and approximate y(3). With the variables y1=y, y2=y′ of the standard reduction, the system and its initial condition are:
Y′=F(t,Y)=[y2siny1],Y(1)=[20]
Two vector Euler steps
ExampleEuler with h=1
Apply two explicit Euler steps with h=1 to the system, from Y0=[2,0]T.
First step: F(1,[2,0]T)=[0,sin2]T=[0,0.9093]T.
Y1=[20]+1⋅[00.9093]=[20.9093]
Second step: F(2,[2,0.9093]T)=[0.9093,sin2]T=[0.9093,0.9093]T.
Y2=[20.9093]+[0.90930.9093]=[2.90931.8186]
The first component approximates the solution: y(3)≈2.9093.
One vector RK4 step
ExampleRK4 with h=2
Apply one RK4 step with h=2 to the same system, from Y0=[2,0]T at t0=1.