Given the initial value problem, "y'=\\dfrac{x-y}{2}" with initial condition "y(0)=1".
The Euler's method states that,
"y_{n+1} = y_{n}+h\\cdot f(x_{n},y_{n})", where "x_{n+1} = x_{n}+h".
Here, "h = 0.5, x_{0} = 0, y_{0} = 1, f(x,y) = y' = \\dfrac{x - y}{2}" .
Step 1:
"x_{1} = x_{0} + h = 0.5\\\\\ny_{1}=y(0.5)=y_{0}+h\\cdot f(x_{0},y_{0})\\\\ = 1+ 0.5 \\left(\\dfrac{0-1}{2}\\right) = 0.75"
Step 2:
"x_{2} = x_{1} + h = 1\\\\\ny_{2}=y(1)=y_{1}+h\\cdot f(x_{1},y_{1})\\\\ = 0.75+ 0.5 \\left(\\dfrac{0.5-0.75}{2}\\right) = 0.6875"
Step 3:
"x_{3} = x_{2} + h = 1.5\\\\\ny_{3}=y(1.5)=y_{2}+h\\cdot f(x_{2},y_{2})\\\\ = 0.6875 + 0.5 \\left(\\dfrac{1-0.6875}{2}\\right) = 0.765625"
Step 4:
"x_{4} = x_{3} + h = 2\\\\\ny_{4}=y(2)=y_{3}+h\\cdot f(x_{3},y_{3})\\\\ \n= 0.765625 + 0.5 \\left(\\dfrac{1.5-0.765625}{2}\\right) = 0.94921875"
Step 5:
"x_{5} = x_{4} + h = 2.5\\\\\ny_{5}=y(2.5)=y_{4}+h\\cdot f(x_{4},y_{4})\\\\ \n= 0.94921875 + 0.5 \\left(\\dfrac{2-0.94921875}{2}\\right)\\\\\n= 1.2119140625"
Step 6:
"x_{6} = x_{5} + h = 3\\\\\ny_{6}=y(3)=y_{5}+h\\cdot f(x_{5},y_{5})\\\\ \n= 1.2119140625 + 0.5 \\left(\\dfrac{2.5-1.2119140625}{2}\\right)\\\\\n= 1.533935546875"
Comments
Leave a comment