Use Euler's method with step size 0.2 to estimate y(1), where y(x) is the solution of the initial-value problem below. Give your answer correct to 4 decimal places.
y' = 1 - xy
y(0) = 0
y(1) = ____ ?
... help, this is what i've done but got the wrong answer..
h = 0.2
x0 = 0
y0 = 0
F(x,y) = 1-xy
y1 = y0 + hF(x0,y0)
= 0 + 0.2(1-(0)(0)) = 0.2
y2 = y1 + hF(x1,y1)
= 0.2 + 0.2(1-(0.2)(0.2)) = 0.392
y3 = y2 + hF(x2,y2)
= 0.392 + 0.2(1-(0.4)(0.392)) = 0.5606
y4 = y3 + hF(x3,y3)
= 0.5606 + 0.2(1-(0.6)(0.5606)) = 0.6934
y5 = y4 + hF(x4,y4)
= 0.6934 + 0.2(1-(0.8)(0.6934)) = 0.7824
y6 = y5 + hF(x5,y5)
= 0.7824 + 0.2(1-(1.0)(0.7824)) = 0.8259
...my answer was 0.8259, which was wrong. please show me what i'm doing wrong? thanks!
y5 is the estimate for y(1), not y6:
y5 = 1528174/1953125 = 0.782425088
The exact answer involves the error function of imaginary argument and is to 30 significant figures:
0.724778459007076331818227967606
You haven't done anything wrong in your work, you have to remember that as you are solving for your y's (y1, y2, y3... etc.) you are also solving for the corresponding x-values (x1, x2, x3... etc.) therefore when your x-value (x5) =1 your corresponding y-value (y5)= .7824
It seems like you made a mistake in calculating y5. Let's go through the steps again to find the correct answer.
Given:
h = 0.2
x0 = 0
y0 = 0
F(x,y) = 1 - xy
Using Euler's method, we have:
y1 = y0 + h * F(x0, y0)
= 0 + 0.2 * (1 - (0)(0))
= 0.2
y2 = y1 + h * F(x1, y1)
= 0.2 + 0.2 * (1 - (0.2)(0.2))
= 0.2 + 0.2 * (1 - 0.04)
= 0.2 + 0.2 * 0.96
= 0.2 + 0.192
= 0.392
y3 = y2 + h * F(x2, y2)
= 0.392 + 0.2 * (1 - (0.4)(0.392))
= 0.392 + 0.2 * (1 - 0.156544)
= 0.392 + 0.2 * 0.843456
= 0.392 + 0.1686912
= 0.5606912
y4 = y3 + h * F(x3, y3)
= 0.5606912 + 0.2 * (1 - (0.6)(0.5606912))
= 0.5606912 + 0.2 * (1 - 0.33641472)
= 0.5606912 + 0.2 * 0.66358528
= 0.5606912 + 0.132717056
= 0.693408256
y5 = y4 + h * F(x4, y4)
= 0.693408256 + 0.2 * (1 - (0.8)(0.693408256))
= 0.693408256 + 0.2 * (1 - 0.5547266048)
= 0.693408256 + 0.2 * 0.4452733952
= 0.693408256 + 0.08905467904
= 0.78246293504
Therefore, the correct estimate for y(1) using Euler's method with step size 0.2 is approximately 0.7825 (rounded to 4 decimal places).
In Euler's method, the formula for approximating the next value, y(x_i+1), given the current value, y(x_i), is:
y(x_i+1) ≈ y(x_i) + h * F(x_i, y(x_i))
Where h is the step size and F(x,y) is the derivative function.
From your calculation, it seems that you have correctly set up the initial conditions:
h = 0.2
x0 = 0
y0 = 0
The derivative function is given as F(x,y) = 1 - x * y.
Now, let's go through the calculation step by step:
Step 1:
x1 = x0 + h = 0 + 0.2 = 0.2
y1 ≈ y0 + h * F(x0, y0) = 0 + 0.2(1 - (0)(0)) = 0.2
Step 2:
x2 = x1 + h = 0.2 + 0.2 = 0.4
y2 ≈ y1 + h * F(x1, y1) = 0.2 + 0.2(1 - (0.2 * 0.2)) = 0.2 + 0.2(1 - 0.04) = 0.2 + 0.2(0.96) = 0.392
Step 3:
x3 = x2 + h = 0.4 + 0.2 = 0.6
y3 ≈ y2 + h * F(x2, y2) = 0.392 + 0.2(1 - (0.4 * 0.392)) = 0.392 + 0.2(1 - 0.156) = 0.392 + 0.2(0.844) = 0.392 + 0.1688 = 0.5608
Step 4:
x4 = x3 + h = 0.6 + 0.2 = 0.8
y4 ≈ y3 + h * F(x3, y3) = 0.5608 + 0.2(1 - (0.6 * 0.5608)) = 0.5608 + 0.2(1 - 0.3365) = 0.5608 + 0.2(0.6635) = 0.5608 + 0.1327 = 0.6935
Step 5:
x5 = x4 + h = 0.8 + 0.2 = 1.0
y5 ≈ y4 + h * F(x4, y4) = 0.6935 + 0.2(1 - (0.8 * 0.6935)) = 0.6935 + 0.2(1 - 0.5548) = 0.6935 + 0.2(0.4452) = 0.6935 + 0.089 = 0.7825
Therefore, using Euler's method with a step size of 0.2, the estimate for y(1) is approximately 0.7825.