# Solve System of Differential Equations using a Table with two variables

I'm trying to solve a system of differential equations, using Table to define the equations I want to solve. I managed to do it with a table with one index, as there is an example in the docs, but I couldn't do it with a matrix. I tried the following code:

eqns = {
Table[
Derivative[y[i, j]][t] == y[i, j][t] - y[i, j][t - 1],
{i, 1, 3},
{j, 1, 3}
],
Table[
y[i, j][t /; t <= 0] == Exp[t*i + j],
{i, 1, 3},
{j, 1, 3}
]
}
NDSolve[eqns, Table[y[i, j], {i, 3}, {j, 3}], {t, 30}];
Plot[Evaluate[Table[y[i, j][t], {i, 3}, {j, 3}] /. %], {t, 0, 30},
PlotLegends -> Automatic]



Any ideas? Thanks!

• Try NDSolve[eqns,Table[y[i,j],{i,3},{j,3}]//Flatten,{t,30}]. The only difference is the additional // Flatten. Look at the output of NDSolve with and without // Flatten to see the difference. Aug 11 at 3:29
• @user293787 thank you very much! I understand the difference now. If you want to put the comment as an answer, I'll accept it as the solution. Aug 11 at 14:43