Exercise 3
Suppose (y(t)) is the solution of the differential equation (y' + y = t^2 + 1) satisfying the initial condition (y(1) = 2) . Estimate (y(2)) using Euler’s method with a step size of (0.5) .
Qaror
Write (y' = t^2 + 1 - y) , so (f(t, y) = t^2 + 1 - y) . Then with (y(1) = 2) , we have (f(1, 2) = 1^2 + 1 - 2 = 0) , so we move horizontally at first, and adjust (y) by zero we estimate (y(1.5)=2) as well. Now we repeat the process, with (f(1.5,2)=(1.5)^2+1-2=1.25) , causing an adjustment by ((0.5)cdot(1.25) = 0.625) . So our estimate is (y(2) = 2.625) .
Exercise 4
Suppose (y(t)) solves the initial value problem [dot + frac<1> <1+t>, y = t^2 ,, qquad y(0) = 1 ,.] Estimate (y(1)) using Euler’s method and four steps. [You can work to four decimal places of precision if you’d prefer to avoid fractions.] If you can, write a computer program that allows you to run Euler’s method on this question with (100) steps.
Qaror
Our step size is (0.25) . Use (y' = t^2 - frac<1+t>) to see that (f(t,y) = t^2 - frac<1+t>) . The algorithm fills in the following table. [oshlanishi t & 0 & 0.25 & 0.5 & 0.75 & 1 hline y & 1 & 0.75 & 0.6136 & 0.5755 & 0.6339 f(t, y) & -1 & -0.5375 & -0.1604 & 0.2336 & end] To four decimal places, the author got (y(1) approx 0.6339) .
With (100) steps, the following MATLAB commands produce an estimate of (0.7856) .
Removing the semicolon in the y = y + yp * 0.01 line will cause MATLAB to print all the output it spews out 100 intermediate values of (y) . In it you can see the decrease followed by increase that we observed when doing it by hand with four steps.
Exercise 5
Suppose (y(t)) solves the differential equation (y' + y = 2t) with initial condition (y(2) = 0) .
Use the implicit Euler method with two steps to estimate (y(3)) .
Solve the equation and determine the actual value of (y(3)) for the solution with a zero at (t=2) .
What if we repeat part (a) with four steps? Does the estimate get any closer to the truth?
Qaror
Throughout this problem we have (f(t,y) = 2t - y) .
Our first equation to solve is [yleft( frac<5> <2> ight) - frac<1> <2>fleft(frac<5><2>, yleft(frac<5><2> ight) ight) = y(2) ,.] Plugging in what’s what, this equation is saying [yleft( frac<5> <2> ight) - frac<1> <2>left( 2 cdot frac<5> <2>- yleft( frac<5> <2> ight) ight) = 0 ,.] Solving this for (y(frac<5><2>)) gives us (y(frac<5><2>)=frac<5><3>) . Now we repeat the process with the equation [yleft(3 ight) - frac<1> <2>left( 3 - y(3) ight) = yleft( frac<5> <2> ight) = frac<5> <3>,.] The estimate we get is (y(3)=frac<28><9>=3.111cdots) .
The equation is linear, and we use the integrating factor (mu(t) = e^t) to solve it. After we multiply through by it, we have (frac
[e^ty] = 2te^t) , so (e^ty = 2te^t - 2e^t + c) , so the general solution is (y(t) = 2t - 2 + c,e^<-t>) . Plugging in (t=2) means (y(2) = 2 + c,e^<-2>) . If we want that to be zero, evidently (c = -2e^2) . Therefore the solution we were estimating in the previous part is [y(t) = 2t - 2 - 2 e^ <2-t>,.] This function has (y(3) approx 3.2642) .
Perhaps instead of doing what we did in part (a) it would be useful to have a formula for (y_) in terms of stuff we can already calculate. We have (y_ - hf(t_, y_) = y_n) , where (h = frac<1><4>) and (f(t,y)=2t-y) . Plugging that in and rearranging gives [y_ = frac<4> <5>left( y_n + frac<>> <2> ight) ,.] Armed with this it’s easy to fill in the following table. [oshlanishi t & 2 & 2.25 & 2.5 & 2.75 & 3 hline y & 0 & 0.9 & 1.72 & 2.476 & 3.1808 end] Indeed the estimate did improve slightly.
2>5>4>4>1>9>28>3>5>2>5>2>1>3>5>2>5>2>5>2>5>2>5>2>1>2>5>2>5>2>5>2>1>2>5>1>
Do'stlaringiz bilan baham: |