# DSolve error:- List encountered within {… } There should be no lists on either side of the equations

I tried to solve the following set of differential equations:

solsDynR2 = DSolve[
{ -p00r'[t] - Λs*p00r[t] + r*p10r[t] + p01r[t] == 0
, -p01r'[t] + Λs*p00r[t] + 2*p02r[t] - (1 + Λs)*p01r[t] + r*p11r[t] == 0
, -p10r'[t] - (2 + Λs)*p02r[t] + (Λs/2)*p01r[t] == 0
, -p11r'[t] - (r + Λs)*p10r[t] + p11r[t] + 2*r*p20r[t] + (Λs/2)*p01r[t] == 0
, -p02r'[t] - (1 + r + Λs)*p11r[t] + Λs*p10r[t] + Λs*p02r[t] == 0
, -p20r'[t] - 2 r*p20r[t] + Λs*p11r[t] == 0
, p00r[0] == 1
, p01r[0] == 0, p10r[0] == 0, p11r[0] == 0, p02r[0] == 0, p20r[0] == 0
}
, { p00r, p01r, p02r, p10r, p11r, p20r}
, t
]


This returns the following error:

DSolve::nolist: List encountered within {{-Λs p00r[t]+p01r[t]+0.0001 p10r[t]-(p00r^′)[t],-Λs p00r[t]+p01r[t]+0.0002 p10r[t]-(p00r^′)[t],-Λs p00r[t]+p01r[t]+0.0003 p10r[t]-(p00r^′)[t],-Λs p00r[t]+p01r[t]+0.0004 p10r[t]-(p00r^′)[t],<<44>>,-Λs p00r[t]+p01r[t]+0.0049 p10r[t]-(p00r^′)[t],-Λs p00r[t]+p01r[t]+0.005 p10r[t]-(p00r^′)[t],<<2440>>}==0,{<<1>>}==0,<<2>>,{<<1>>}==0,{<<1>>}==0}. There should be no lists on either side of the equations.

I've solved similar equations in this way without a problem before, and I've searched everywhere for the potential source of the problem, without success.

Any insight would be greatly appreciated.

Thanks!

• Did you try running this on a fresh kernel? – J. M. will be back soon Apr 9 '18 at 12:11
• Have just tried, was proabably the source of the problem! Though now it seems it's not able to evaluate at all, will give it a bash with NDSolve.. Thanks! – Gregory Ionovich Page Apr 9 '18 at 12:21
• No need for NDSolve[]: MatrixExp[{{-Λs, 1, 0, r, 0, 0}, {Λs, -1 - Λs, 2, 0, r, 0}, {0, 0, Λs, Λs, -1 - r - Λs, 0}, {0, Λs/2, -2 - Λs, 0, 0, 0}, {0, Λs/2, 0, -r - Λs, 1, 2 r}, {0, 0, 0, 0, Λs, -2 r}} t, UnitVector[6, 1]] – J. M. will be back soon Apr 9 '18 at 12:40
• Wonderful! I've never seen this technique before. thanks alot – Gregory Ionovich Page Apr 9 '18 at 14:00
• Yep, now you need to read up on the "matrix exponential" and on how to use it to solve constant-coefficient equations like yours. ;) – J. M. will be back soon Apr 9 '18 at 14:10

To settle the whole thing: DSolve[] does work on the system after clearing variables, but it is more convenient to use the matrix exponential for a constant-coefficient ODE such as this:

{p00r[t_], p01r[t_], p02r[t_], p10r[t_], p11r[t_], p20r[t_]} =
MatrixExp[{{-Λs, 1, 0, r, 0, 0},
{Λs, -1 - Λs, 2, 0, r, 0},
{0, 0, Λs, Λs, -1 - r - Λs, 0},
{0, Λs/2, -2 - Λs, 0, 0, 0},
{0, Λs/2, 0, -r - Λs, 1, 2 r},
{0, 0, 0, 0, Λs, -2 r}} t].UnitVector[6, 1]


where UnitVector[6, 1] represents the initial conditions p00r[0] == 1, etc.

However, it is more efficient to use the action form of MatrixExp[], as that avoids generating a full matrix when only a vector of solutions is needed:

{p00r[t_], p01r[t_], p02r[t_], p10r[t_], p11r[t_], p20r[t_]} =
MatrixExp[{{-Λs, 1, 0, r, 0, 0},
{Λs, -1 - Λs, 2, 0, r, 0},
{0, 0, Λs, Λs, -1 - r - Λs, 0},
{0, Λs/2, -2 - Λs, 0, 0, 0},
{0, Λs/2, 0, -r - Λs, 1, 2 r},
{0, 0, 0, 0, Λs, -2 r}} t, UnitVector[6, 1]]

• Something funny I noticed. Before, I had the whole output list as 'MSoln[[CapitalLambda]s_, r_, t_] ' whose components I extracted using Part[MSoln[[CapitalLambda]s, r, t], n] (where n denotes the position in the list), which I was then able to plot without a hitch. However with your ' {p00r[t_], p01r[t_], p02r[t_], p10r[t_], p11r[t_], p20r[t_]}' notation, every attempt to plot the list element failed. Might you have an idea as to why ? – Gregory Ionovich Page Apr 11 '18 at 14:18
• Ah, that's because I didn't put in Λs and r as parameters. You can change it so that p00r[t], etc. are explicitly dependent on them: {p00r[Λs_, r_, t_], p01r[Λs_, r_, t_], (* stuff *)} = MatrixExp[(* stuff *)]. (Clear everything before doing this, of course.) – J. M. will be back soon Apr 11 '18 at 14:25
• Yes that did the trick. Does this method need a special way to differentiate the list elements? It doesn't seem to like the standard D[f(t),t]. (At least, it is throwing up 'general' errors when I evaluate the differential for given values of the parameters..) – Gregory Ionovich Page Apr 11 '18 at 15:48
• You can use something like D[p00r[Λs, r, t], t] for symbolics. If you want to be able to evaluate the derivative numerically, the syntax is a bit more cumbersome: Derivative[0, 0, 1][p00r][Λs, r, t] (where Derivative[0, 0, 1][p00r] says "take the first derivative with respect to the third argument of p00r"). – J. M. will be back soon Apr 11 '18 at 20:50