How do I construct such a numerical method for solving ODE?

97 Views Asked by At

I am asked to expand $x(t+h)$ and $x(t+2h)$ around $t$ up to the rest term of the third order, find $A, B, C \in \mathbb R$ such that

$$x'(t)=\frac{Ax(t)+Bx(t+h)+Cx(t+2h)}{h} + O(h^2)$$

and based on that formulate a method for solving $x'(t)=\lambda x(t)$ to consequently show that the developed method is consistent yet not convergent.

The method I came up with produces utter nonsense in Matlab, even for simple values, such as $\lambda=1, h=0.1, t\in[0,1], x_0=1$, so I concluded I must have done something wrong. (Since for such values consistency alone should be enough for method to produce results remotely resembling the true ones.)

I expanded: $$x(t+h)=x(t)+hx'(t)+\frac{1}{2}h^2x''(t)+O(h^3)$$ $$x(t+2h)=x(t)+2hx'(t)+2h^2x''(t)+O(h^3)$$

Solved both for $h^2x''(t)$ made the rest equal and solved again for $x'(t)$:

$$x'(t)=\frac{-1.5x(t)+2x(t+h)-0.5x(t+2h)}{h} + O(h^2)$$

To formulate the method we drop the big O, replace $x'(t)$ with $\lambda x_k, x(t+h)$ with $x_{k+1}, x(t+2h)$ with $x_{k+2}$ and solve for $x_{k+2}$:

$$x_{k+2}=4x_{k+1}+x_k(-3-2h\lambda)$$

Does this even make sense?

1

There are 1 best solutions below

0
On BEST ANSWER

Subtract $4$ times the following equation,

$$x(t+h)=x(t)+hx'(t)+\frac{1}{2}h^2x''(t)+O(h^3)$$

from

$$x(t+2h)=x(t)+2hx'(t)+2h^2x''(t)+O(h^3)$$

to obtain

$$x'(t)=\frac{-3x(t)+4x(t+h)-x(t+2h)}{2h} + O(h^2).$$

This is equivalent to your result and is the well-known three-point forward difference approximation.

To test for convergence, substitute $x_n = r^n$ into your difference equation. Solve the resulting quadratic equation for r. For given parameters, both roots must satisfy certain conditions to ensure stability and hence, convergence -- no growing parasitic solutions. Consistency and stability implies convergence (Lax-Richtmeyer).

In this case,

$$r^2 -4r + (3+2h\lambda) = 0,$$

$$r=2\pm\sqrt{1-2h\lambda}.$$

The general solution of the difference equation is a linear combination of $(2-\sqrt{1-2h\lambda})^n$ and $(2+\sqrt{1-2h\lambda})^n$. The first sequence will approximate the solution of the differential equation when the step size satisfies $h < 1/\lambda$, but the second is a parasitic solution that will diverge rapidly for any choice of $h$.