[Math] Backward Euler for a system of equations

numerical methodsordinary differential equations

I have tried to solve a system of equations in the form:

$$\eqalign{
{dy_1\over dt }&= y_1 +dt*f(y_1,y_2)\cr

{dy_2\over dt} &= y_2 +dt*g(y_1,y_2)
}
$$

using different schemes such as forward Euler and backward (implicit) Euler and Runge Kutta order 4. My results seem to be OK for the forward Euler scheme and Runge Kutta above a certain number of time steps (A). But for implicit Euler using A time steps, I get an error after a certain number of time steps (say A-100). I was wondering if anyone had any ideas of what the problem might be. I can't think of anything at all.

Thanks!


Sorry, the correct equations are:

$$\eqalign{
{dy_1\over dt }&= f(y_1,y_2)\cr

{dy_2\over dt} &= g(y_1,y_2)
}
$$

where $y_1$ and $y_2$ have a size $n$ by $1$ ($n$ an integer greater than 1). I also just realized that if I use much smaller than that of explicit euler my reuslts become OK. I am now thinking it could be because I used forward euler to work out the initial RHS's at the new time step, to calculate the $y_1$ and $y_2$ at the new time steps.

Best Answer

So basically what you get by applying Backward Euler is the following two equations, \begin{equation} y_{1}^{n+1} = y_{1}^n + h * f(y_1^{n+1}, y_2^{n+1}), \end{equation} \begin{equation} y_{2}^{n+1} = y_{2}^n + h * g(y_1^{n+1}, y_2^{n+1}). \end{equation} Theoretically, using this scheme your method should be more stable. So maybe you can start testing your solution by using larger time steps and checking if the method stays stable. Considering what you explained above I suspect either you're having some bug in your code or you are introducing some errors in the initial values by using Forward Euler to start the computations which is not allowed. $f$ and $g$ are both known functions I assume.

Related Question