Given the initial value problem, y′=2x−y with initial condition y(0)=1.
The Euler's method states that,
yn+1=yn+h⋅f(xn,yn), where xn+1=xn+h.
Here, h=0.5,x0=0,y0=1,f(x,y)=y′=2x−y .
Step 1:
x1=x0+h=0.5y1=y(0.5)=y0+h⋅f(x0,y0)=1+0.5(20−1)=0.75
Step 2:
x2=x1+h=1y2=y(1)=y1+h⋅f(x1,y1)=0.75+0.5(20.5−0.75)=0.6875
Step 3:
x3=x2+h=1.5y3=y(1.5)=y2+h⋅f(x2,y2)=0.6875+0.5(21−0.6875)=0.765625
Step 4:
x4=x3+h=2y4=y(2)=y3+h⋅f(x3,y3)=0.765625+0.5(21.5−0.765625)=0.94921875
Step 5:
x5=x4+h=2.5y5=y(2.5)=y4+h⋅f(x4,y4)=0.94921875+0.5(22−0.94921875)=1.2119140625
Step 6:
x6=x5+h=3y6=y(3)=y5+h⋅f(x5,y5)=1.2119140625+0.5(22.5−1.2119140625)=1.533935546875
Comments