# Compute approximation of ODE using one step of explicit/implicit Euler method

I'm given the IVP:

$$u^{(3)}(t) + u'(t) = tu(t)$$ $$u''(2) = 2$$ $$u(2) = 0$$ $$u'(2) = 1$$

and am asked to approximate the solution for $$t=2.5$$ using one step of the explicit Euler-method and one step of the implicit Euler-method. I began with a transformation into a system of first order ODEs.

\begin{align*} u_0'(t) &= u_1(t) \\ u_1'(t) &= u_2(t) \\ u_2'(t) &= tu_0(t) - u_1(t) \\ u_0(2) &= 0 \\ u_1(2) &= 1 \\ u_2(2) &= 2 \\ \end{align*} - Explicit Euler-method:

\begin{align*} u_0(2.5) &= u_0(2) + 0.5u_1(2) = 0.5 \\ u_1(2.5) &= \dots = 1 \\ u_1(2.5) &= \dots = -0.5 \end{align*}

• Implicit Euler-method: I seem to end in an infinite loop where I can't rearrange to find a solution:

$$u_0(2.5) = u_0(2) + 0.5u_1(2.5) = 0.5(u_1(2) + 0.5u_1(2.5))$$ $$= 0.5 + 0.25(u_2(2) + 0.5(2.5u_0(2.5) - u_1(2.5))) = 1 +\frac{1}{8 }(2.5u_0(2.5) - u_1(2.5))$$

Now this seems to go on forever. What am I doing wrong? Or am I actually on the right track here? I can't seem to ever get a term with just $$u_0(2.5)$$ on the RHS.

Note that in general to get to barely useful results with the Euler methods, one should observe the guideline that $$Lh<1.5$$. Here with $$L\approx 2$$ and $$h=0.5$$ that is satisfied.

The explicit step should have $$u_0(2.5)=0.5$$, $$u_1(0.5)=1+0.5⋅2=2$$ and $$u_2(2.5)=2+0.5⋅(2⋅0-1)=1.5$$, somehow in the omitted part there are some terms missing.

For the implicit step, you get a non-trivial system $$u(t)=(I-hA)u(t+h)$$ that you have to solve via Gauß elimination or similar. $$\pmatrix{0\\1\\2} = \pmatrix{1&-0.5&0\\0&1&-0.5\\-0.5\cdot 2.5&0.5&1} \pmatrix{u_0(2.5)\\u_1(2.5)\\u_2(2.5)}$$ which solves as $$u_0(2.5)=1.06666667$$, $$u_1(2.5)=2.13333333$$, $$u_2(2.5)=2.26666667$$.

A more exact integration with a higher order method gives the value table $$\begin{array}{c|ccc} t&u_0(t)&u_1(t)&u_2(t)\\\hline 2.000 & 0.00000000 & 1.00000000 & 2.00000000 \\ 2.100 & 0.10983395 & 1.19502947 & 1.90118241 \\ 2.200 & 0.23868570 & 1.38047638 & 1.80957168 \\ 2.300 & 0.38564537 & 1.55743288 & 1.73264001 \\ 2.400 & 0.54995008 & 1.72774964 & 1.67807126 \\ 2.500 & 0.73106066 & 1.89405346 & 1.65369605 \\ \end{array}$$ which is not exactly close in the last row.

• Even for the implicit method, it's a good idea to adhere to the $Lh<1.5$ rule to avoid propagation of errors. Commented Jul 16, 2019 at 14:43
• I missed that the step is from 2 to 2.5, so that with $h=0.5$ that rule is actually satisfied. Commented Jul 16, 2019 at 14:45
• @LutzL Thank you really much for the comprehensive answer! Commented Jul 16, 2019 at 14:55
• This surprises me a bit! I would've imagined that satisfying the explicit time-step criterion with $h=0.5$ would have yielded an implicit solution a lot closer to the one with $h=0.1$. In fact $u_2(2.5)$ with $h=0.5$ also appears to be trendwise incorrect! Could you double-check your calculations? Commented Jul 16, 2019 at 14:56
• @SharatVChandrasekhar : You mean implicit $h=0.5$ should be about as precise as explicit with $h=0.1$? Using time steps close to the stability boundary will in general give chaotic results, for suitably small time steps the errors of explicit and implicit methods should not differ much, the implicit is just better in terms of stability and staying on the right side of positivity constraints. Commented Jul 16, 2019 at 15:00