[Math] Determine the local truncation error of the following method

numerical methodsordinary differential equations

Consider the ordinary differential equation

$$y'(t)=f(t,y(t))$$

Let $y_n$ be an approximate to $y(t_n)$, where $t_n = nh$ and h is constant step size. Determine the local truncation error of the following method.

$$y_{n+1}=y_n+\left(\frac h2\right)(3f(t_n,y_n)-f(t_{n-1},y_{n-1}))$$

As far as I can tell I need to do a Taylor expansion for the left and right side and check to see which term they differ at to get the error.

I know the left hand side is:

$y(t_{n+1}) = y(t_n)+y'(t_n)h+ \frac{y''(t_n)h^2}{2}+\frac{y'''(t_n)h^3}{6}+…$

So on the right side I have that

$y(t_n)+\frac h2(3y'(t_n) – y'(t_{n-1}))$

$y(t_n)+\frac h2(3y'(t_n) – [y'(t_n)+y''(t_n)(-h)+\frac{y'''(t_n)(-h)^2}{2}+\frac{y''''(t_n)(-h)^3}{6}+…])$

$y(t_n)+\frac h2(3y'(t_n) – y'(t_n)+y''(t_n)h-\frac{y'''(t_n)h^2}{2}+\frac{y''''(t_n)h^3}{6}+…)$

$y(t_n)+\frac {3y'(t_n)h}{2} – \frac {y'(t_n)h}{2}+\frac{y''(t_n)h^2}{2}-\frac{y'''(t_n)h^3}{4}+\frac{y''''(t_n)h^4}{12}+…$

$y(t_n)+y'(t_n)h +\frac{y''(t_n)h^2}{2}-\frac{y'''(t_n)h^3}{4}+\frac{y''''(t_n)h^4}{12}+…$

I think since they differ on the 4th term the error would be $O(h^3)$

Best Answer

Hint. Consider $g(t) = f(t, y(t))$. Then the rhs becomes $$ y(t_n) + \frac{h}{2}(3g(t_n) - g(t_{n-1})). $$ That should be easy to expand in Taylor series. Next, observe that $g(t)$ is simply $y'(t)$ (also $g'(t)$ is $y''(t)$, etc) due to the fact that $y(t)$ is a solution to $$ y'(t) = f(t, y(t)) $$

Appendix. Collected by $h$ the LHS is $$y(t_n) + h y'(t_n) + \frac{h^2}{2}y''(t_n) + \frac{h^3}{6}y'''(t_n) + O(h^4)$$ and the RHS is $$y(t_n) + h y'(t_n) + \frac{h^2}{2} y''(t_n)- \frac{h^3}{4} y'''(t_n) + O(h^4)$$ The difference is $\frac{5h^3}{12}y'''(t_n) + O(h^4)$. But it is not the truncation error yet. To get the truncation error you need to eliminate the spurious multiplier of $h^k$ magnitude. The presence of this multiplier can be spotted as the truncation error for an ODE method always has form of $Ch^k y^{(k+1)}(t_n)$.

The ODE $$ y' = f(t, y(t)) $$ is not formally approximated by $$ y_{n+1} = y_{n} + \frac{h}{2}(3f(t_n,y_n) - f(t_{n-1}, y_{n-1})) $$ since the latter converges to identity $$ y(t) = y(t) $$ when $h \to 0$. To get the approximating form you should first rewrite it as $$ \frac{y_{n+1} - y_n}{h} = \frac{3}{2}f(t_n,y_n) - \frac{1}{2}f(t_{n-1}, y_{n-1}). $$ While being just the same method, this equation converges to $$ y' = f(t, y(t)) $$ and formally approximates the ODE. That form should be studied for the truncation error. Expanding both sides using Taylor series gives the truncation error (difference between left and right sides) $$ \epsilon = \frac{5h^2}{12}y'''(t_n) + O(h^3) $$ which is just the same that we've obtained earlier but without $h$ multiplier. Indeed, this is the Adams–Bashforth second order method.