I got the following question in a math lecture the other day, and I'm not really sure how to go about it:

A differential equation is given in the form $$\frac{\partial y}{\partial x} = f (x, y(x))$$ where the function $f$ is known. To solve it numerically, one can use a two-step finite-difference scheme: $$y_{i+1} = \alpha y_i + \beta y_{i−1} + (\mu f_i + \nu f_{i−1}) \Delta x$$ where $$\Delta x = x_i − x_{i−1}\\ y_i = y(x_i)\\ f_i = f(x_i, y_i)$$ and $\alpha,\beta,\mu,\nu$ are constants.

Show that for $\alpha=1,\ \beta=0,\ \mu=3/2,\ \nu=–1/2$, this scheme gives errors of approximately $(\Delta x)^3$.

I'm guessing I use a Taylor Expansion of $y(x+\Delta x)$ and then compare the resulting equations, but when I do I can't see how I'm going to get an error of $(\Delta x)^3$. Any help is appreciated.


Yes, Taylor expansions are your friends here. Your local truncation error is given by \begin{align} & y_{i+1} - y_i - \Delta x (3/2 f_i - 1/2 f_{i-1}) \\ & = \left( y_i + \Delta x y_i' + \frac{\Delta x^2}{2} y_i'' + \mathcal{O}(\Delta x^3) \right) - y_i \\ & + \Delta x \left( \frac{3}{2}f_i - \frac{1}{2} \left( f_i - \Delta x f_i' + \mathcal{O}(\Delta x^2) \right) \right) \\ &= \Delta x(y_i' - f_i) + \frac{\Delta x^2}{2}(y_i'' - f_i') + \mathcal{O}(\Delta x^3). \end{align} The first two terms are zero from statement of the question so your scheme will have a local truncation error of $\mathcal{O}(\Delta x^3)$. Note that the global error is typically reduced one order.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.