HW Seven

  1. 7.1

    (a)

    $\displaystyle y'(t_j) = \frac{y(t_j)-y(t_{j-2})}{2 h},$

    truncation error is proportional to $y''(t_j) h$, i.e. this is first order accurate scheme.

    (b)

    $\displaystyle y'(t_j) = -\frac{1}{2h} y(t_j) + \frac{2}{3h}y(t_{j+1}) -\frac{1}{6h}y(t_{j-2}),$

    with the truncation error given by $y'''(t)h^2/3.$

    (c)

    $\displaystyle y'(t_j = \frac{4}{3h} y(t_j) - \frac{3}{2h}y(t-h)+\frac{1}{6h}y(t-3h),$

    with truncation error being $\frac{h^2}{2}y'''(t)$.

    (d)

    $\displaystyle y''(t) = \frac{1}{h^2} y(t)-\frac{2}{h^2}y(t-h)+\frac{1}{h^2}y(t-2h),$

    with truncation error of $h y'''(t)$.

  2. (a)

    $\displaystyle y''(t) = \frac{y'(t+h)-y'(t-h)}{2h}.$

    (b)

    $\displaystyle y'(t) = \frac{y'(t+h)-y'(t-h)}{2h}.$

    The truncation error is $h^2 y'''(t)/6$.

    (c)

    $\displaystyle y(t) = \frac{y(t-h)+y(t+h)}{2}.$

    While this result is intuitive and obvious, this is obtained by method of undertermined coefficients.

    (d)

    $\displaystyle 2 y'[y]-3y[t]= y(t-2h)-(\frac{1}{h}+3)y(t-h)+(\frac{1}{h}-1)y(t+h).$

    Command in Mathematica to check the correctness of this answer is given by

       Series[y[t-h],{h,0,4}]-(1/h+3) Series[y[t-h],{h,0,4}] + (1/h-1) Ser
       %ies[y[t+h],{h,0,4}]
       

    (e)

    $\displaystyle y'(t)+5y(t) = (\frac{5}{3}-\frac{1}{2h})y(t-h)+(5+\frac{1}{2h})y(t+h)
-\frac{5}{3}y(t+2h).$

    The correctness of this solution can be checked by the Mathematica command

    (5/3-1/(2h))Series[y[t-h],{h,0,4}]+(5+1/(2h)) Series[y[t+h],{h,0,4}] + (-5/3) Series[y[t+2h],{h,0,4}]
    

  3. 7.9

    (a)

    To find the general solution of the equation

    $\displaystyle y'(t)-y(t)=t^2 -1,$

    we use the method of the integrating factor from the DFQ cours. The general solution is

    $\displaystyle y(t) = -(1+t)^2 + C e^t.$

    To satisfy $y(0)=1$ we have $1 =-1+C$ we have $C=2$. In other words, the solution to this IVP is

    $\displaystyle y(t) = -(1+t)^2 + 2 e^t.$

    (b)

    $\displaystyle f(t,y(t)) = y(t)+t^2-1.$

    (c) We obtain

    $\displaystyle y(t=\frac{1}{3}) = -\frac{16}{9} + 2 e^{\frac{1}{3}}\simeq 1.0134,$

    and

    $\displaystyle y(t=\frac{2}{3}) = -\frac{25}{9} + 2 e^{\frac{2}{3}}\simeq 1.11769.$

    (d)

    Euler method with $h=\frac{1}{3}$ gives

    $\displaystyle y_1= y_0 + \frac{1}{3}(y_0 - 1) = 1,$

    and

    $\displaystyle y_2 = y_1 + \frac{1}{3}(y_1+\frac{1}{9} -1) = \frac{28}{27}
\simeq 1.03704.$

    The errors are

    $\displaystyle \epsilon_1 \simeq 0.0134,$

    and

    $\displaystyle \epsilon_2\simeq 0.08065.$

    (e) The backward Euler gives

    $\displaystyle y_1= y_0 + \frac{1}{3}(y_1 + \frac{1}{3^2} - 1),$

    with $y_0=1$ this gives

    $\displaystyle y_1 = \frac{19}{18}\simeq 1.05556.$

    Similarly,

    $\displaystyle y_2= y_1 + \frac{1}{3}(y_1 + \frac{4}{3^2} - 1),$

    which gives

    $\displaystyle y_2 = \frac{47}{36}\simeq 1.305555556.$

  4. 7.18

    (a)

    $\displaystyle y_{i+1} = y_{i-1} + \frac{h}{3}
\left( f(t_{i-1},y_{i-1}) + 4 f(t_{i},y_{i}) +
f(t_{i+1},y_{i+1})\right).$

    The truncation error is that of the Simpson's method:

    $\displaystyle \vert y_{i+1} - y(t_{i+1}\vert\simeq \frac{h^5}{180}\frac{\partial ^4}{\partial t^4}
f(t,y(t))\vert _{t=t_i}.$

    (b)

    $\displaystyle y_{i+1} = y_{i-1} + 2 h f(t_{i},y_{i}).$

    The truncation error is that of the mid-point rule, that is

    $\displaystyle \vert y_{i+1} - y(t_{i+1}\vert\simeq \frac{h^3}{3}\frac{\partial ^2}{\partial t^2}
f(t,y(t))\vert _{t=t_i}.$