Solution:
The iterative formulas for Euler's method are "x_{n+1}=x_n+h," "y_{n+1}=y_n+h\\times f(x_n, y_n)" , where "y'=f(x,y)" , "y(x_0)=y_0"
In this case "f(x,y)=x^2+y^2" , "x_0=0," "y_0=3"
I) Solution for h=0.1
"x_1=x_0+h=0+0.1=0.1"
"y_1=y_0+h\\times f(x_0, y_0)=3+0.1\\times (0^2+3^2)=3.9"
Analogically, searching for the next points of the solution - "x_2, y_2, x_3, y_3, x_4, y_4, x_5, y_5," until reaching the desired value y(0.5)
"x_2=x_1+h=0.1+0.1=0.2"
"y_2=y_1+h\\times f(x_1, y_1)" "=3.9+0.1\\times (0.1^2+3.9^2)=5.422"
"x_3=x_2+h=0.3"
"y_3=y_3+h\\times f(x_3, y_3)" "=5.422+0.1\\times (0.2^2+5.422^2)=8.3658"
"x_4=x_3+h=0.4"
"y_4=y_4+h\\times f(x_4, y_4)" "=8.3658+0.1\\times (0.3^2+8.3658^2)=15.3735"
"x_5=x_4+h=0.5"
"y_5=y_4+h\\times f(x_4, y_4)" "=15.3735+0.1\\times (0.4^2+15.3735^2)=39.0239"
So the answer for h=0.1 is "y(0.5)=39.0239"
II)Solution for h=0.05
"x_1=x_0+h=0+0.05=0.05"
"y_1=y_0+h\\times f(x_0, y_0)" "=3+0.05\\times (0^2+3^2)=3.45"
"x_2=x_1+h=0.1"
"y_2=y_1+h\\times f(x_1, y_1)" "=3.45+0.05\\times (0.05^2+3.45^2)=4.0453"
"x_3=x_2+h=0.15"
"y_3=y_2+h\\times f(x_2, y_2)" "=4.0453+0.05\\times (0.1^2+4.0453^2)=4.8640"
"x_4=x_3+h=0.2"
"y_4=y_3+h\\times f(x_3, y_3)" "=4.8640+0.05\\times (0.15^2+4.8640^2)=6.0480"
"x_5=x_4+h=0.25"
"y_5=y_4+h\\times f(x_4, y_4)" "=6.0480+0.05\\times (0.2^2+6.0480^2)=7.8789"
"x_6=x_5+h=0.3"
"y_6=y_5+h\\times f(x_5, y_5)" "=7.8789+0.05\\times (0.25^2+7.8789^2)=10.9858"
"x_7=x_6+h=0.35"
"y_7=y_6+h\\times f(x_6, y_6)" "=10.9858+0.05\\times (0.3^2+10.9858^2)=17.0248"
"x_8=x_7+h=0.4"
"y_8=y_7+h\\times f(x_7, y_7)" "=17.0248+0.05\\times (0.35^2+17.0248^2)=31.5231"
"x_9=x_8+h=0.45"
"y_9=y_8+h\\times f(x_8, y_8)" "=31.5231+0.05\\times (0.4^2+31.5231^2)=81.2163"
"x_{10}=x_9+h=0.5"
"y_{10}=y_9+h\\times f(x_9, y_9)" "=81.2163+0.05\\times (0.45^2+81.2163^2)=411.0307"
So the answer for h=0.05 is "y(0.5)=411.0307"
Answer: "y(0.5)\\approx 39.0239 (h=0.1)"
"y(0.5) \\approx 411.0307 (h=0.05)"
Results of all the calculations are summarized in a tabular form (screenshot attached)
Comments
Leave a comment