# Thread: Solving a system of differential equations using central difference approximations

1. ## Solving a system of differential equations using central difference approximations

Good day,

I am having a bit a trouble solving this system:

$\displaystyle y^{'} = v$

$\displaystyle v^{'} = \lambda y$

Incorporating the following central difference approximations:

$\displaystyle v_{i} =\frac{y_{i+1}-y_{i-1}}{2\Delta x}$

$\displaystyle \lambda y_{i} = \frac{v_{i+1}-v_{i-1}}{2\Delta x}$

I've made an attempt to solve this using a method I use when I encounter linear de's rather than a system. I don't know if its valid in a system case...

First thing, I shifted the indices for $\displaystyle v_{i}$

ie. $\displaystyle v_{i+1} =\frac{y_{i+2}-y_{i}}{2\Delta x}$
$\displaystyle v_{i-1} =\frac{y_{i}-y_{i-2}}{2\Delta x}$

Substituting these into the $\displaystyle \lambda y_{i}$:

$\displaystyle y_{i+2}+y_{i}\alpha+y_{i-2}=0$
Where, $\displaystyle \alpha = -2-4(\Delta x)^{2}\lambda$

From here I let $\displaystyle y_{i}=n^{i}$, sub it into the equation and basically solve for n.

I get a solution for $\displaystyle y_{i}$ that contains like 6 constants.

I use this to solve for $\displaystyle v_{i}$ which results in a long solution with many square roots.

As I mentioned I'm highly doubtful if this is actually how you do it... Any help would be greatly appreciated.

Thanks

2. ## Re: Solving a system of differential equations using central difference approximation

Originally Posted by MrPhil
Good day,

I am having a bit a trouble solving this system:

$\displaystyle y^{'} = v$

$\displaystyle v^{'} = \lambda y$

Incorporating the following central difference approximations:

$\displaystyle v_{i} =\frac{y_{i+1}-y_{i-1}}{2\Delta x}$

$\displaystyle \lambda y_{i} = \frac{v_{i+1}-v_{i-1}}{2\Delta x}$

I've made an attempt to solve this using a method I use when I encounter linear de's rather than a system. I don't know if its valid in a system case...

First thing, I shifted the indices for $\displaystyle v_{i}$

ie. $\displaystyle v_{i+1} =\frac{y_{i+2}-y_{i}}{2\Delta x}$
$\displaystyle v_{i-1} =\frac{y_{i}-y_{i-2}}{2\Delta x}$

Substituting these into the $\displaystyle \lambda y_{i}$:

$\displaystyle y_{i+2}+y_{i}\alpha+y_{i-2}=0$
Where, $\displaystyle \alpha = -2-4(\Delta x)^{2}\lambda$

From here I let $\displaystyle y_{i}=n^{i}$, sub it into the equation and basically solve for n.

I get a solution for $\displaystyle y_{i}$ that contains like 6 constants.

I use this to solve for $\displaystyle v_{i}$ which results in a long solution with many square roots.

As I mentioned I'm highly doubtful if this is actually how you do it... Any help would be greatly appreciated.

Thanks
Seems like a lot of work, who said to use central differences?

CB

3. ## Re: Solving a system of differential equations using central difference approximation

Originally Posted by CaptainBlack
Seems like a lot of work, who said to use central differences?

CB
In a lecture, we had two examples(that weren't systems) and solved them using finite difference methods. We were left to attempt this question along with the two central difference approximations. I would have used Adam's Method to solve something like this.

4. ## Re: Solving a system of differential equations using central difference approximation

Originally Posted by MrPhil
In a lecture, we had two examples(that weren't systems) and solved them using finite difference methods. We were left to attempt this question along with the two central difference approximations. I would have used Adam's Method to solve something like this.
Write your system as a vector first order ODE:

$\displaystyle {\bf{X}}'=f(t,{\bf{X}})={\bf{AX}}$

where $\displaystyle {\bf{X}}=(y,v)^T$ and $\displaystyle {\bf{A}}=\left[\begin{array}{cc}0&1\\\lambda&0 \end{array}\right]$

Now just write your method out in terms of vector $\displaystyle \bf{X}$ and everything should work as in the scalar case.

But I still always use Euler's method or a (possibly iterated) first order predictor corrector method for these things, but I know that I am in a small minority.

CB