Leland Morrow

2022-06-24

I was given the following second-order differential equation,
${y}^{\mathrm{\prime }\mathrm{\prime }}+2{y}^{\mathrm{\prime }}+y=g\left(t\right),$
and that the solution is $y\left(t\right)=\left(1+t\right)\left(1+{e}^{-t}\right)$. Using the solution I determined that
$g\left(t\right)=t+3.$
Following from this I transformed this second-order differential equation into a system of first-order differential equations, which is
$\left(\begin{array}{c}{x}_{1}\\ {x}_{2}\end{array}\right)=\left(\begin{array}{cc}0& 1\\ -1& -2\end{array}\right)\left(\begin{array}{c}y\\ {y}^{\mathrm{\prime }}\end{array}\right)+\left(\begin{array}{c}0\\ t+3\end{array}\right)$
Now I want to perform a single step with $\mathrm{\Delta }t=1$ starting from t=0 with the Forward Euler method and after that with the Backward Euler method. Firstly with the Forward Euler method I use:
${w}_{n+1}={w}_{n}+\mathrm{\Delta }tf\left({t}_{n},{w}_{n}\right)$
and I compute ${w}_{0}$ as
${w}_{0}=\left(\begin{array}{c}y\left(0\right)\\ {y}^{\mathrm{\prime }}\left(0\right)\end{array}\right)=\left(\begin{array}{c}2\\ 1\end{array}\right)$
so therefore
${w}_{1}=\left(\begin{array}{c}3\\ 0\end{array}\right)$
Now I want to perform the Backward Euler method.
${w}_{n+1}={w}_{n}+\mathrm{\Delta }tf\left({t}_{n+1},{w}_{n+1}\right)$
so
${w}_{1}=\left(\begin{array}{c}2\\ 1\end{array}\right)+\left(\begin{array}{cc}0& 1\\ -1& -2\end{array}\right){w}_{1}+\left(\begin{array}{c}0\\ 4\end{array}\right)$
From which i get
${w}_{1}=\frac{1}{4}\left(\begin{array}{c}11\\ 3\end{array}\right)$
y two results seems to be quite differnt and that gets me to believe that I have made a mistake somewhere. Could someone let me know if they believe this to be correct, or why this could be wrong?

Bruno Hughes

Note that the second is $\left(2.75,0.75{\right)}^{T}$. Your results are not that different for a step size of $\Delta t=1$ and a Lipschitz constant L between 2 and 3. This setup is on the border between barely useful and chaotic, you want $L\Delta t$ smaller 1.5 for results that are qualitatively valid, and smaller 0.1 for results that begin to be quantitatively valid.
If you want to get a better intuition of that, repeat the calculation with smaller step sizes 0.5, 0.25, 0.1 (and the correspondingly increased step number) and observe that the error shrinks roughly linearly in the step size.

Do you have a similar question?