I encounter a rather strange problem in Mathematica when trying to solve the following system of linear differential equations:

ODESys := X'[t] == M.X[t]
InCond := X[0] == {5,0,5/2}
DSolve[{ODESys, InCond}, X[t], {t, 0, 1000}]

Despite the fact that the system should have an existing and unique solution (the eigenvalues of M are all nondegenerate and the eigenvectors are linearly independent), the ouput from the above code is empty, giving the warning

DSolve::bvnul: "For some branches of the general solution, the given boundary conditions lead to an empty solution".

However, there should not exist different branches. Also when using NDSolve instead of DSolve, the code works like a charm. Any ideas why the above code does not work for DSolve will be highly appreciated.

  • $\begingroup$ You need to define X: X[t_] = {x[t], y[t], z[t]}. $\endgroup$ Commented Aug 11, 2014 at 12:09
  • $\begingroup$ Thank you very much. Now it is working. As in NDSolve there is no need to define the vector X explicitly (its dimensions are taken from the initial conditions), I assumed the same for DSolve, which was obviously wrong. $\endgroup$
    – Alex
    Commented Aug 11, 2014 at 12:27
  • $\begingroup$ I have to admit that I find it an odd syntactical difference that NDSolve works while DSolve does not. I don't think I'd call it a bug, though. $\endgroup$ Commented Aug 11, 2014 at 12:30

1 Answer 1

mat = {{0, 1, 0}, {0, -1, 1}, {2, 0, -4}};
xm = {x[t], y[t], z[t]};
sol = First[
   DSolve[{D[xm, t] == mat.xm, (xm /. t -> 0) == {5, 0, 5/2}}, xm, 
Plot[Evaluate[{x[t], y[t], z[t]} /. sol], {t, 0, 5}, 
 PlotLegends -> xm, Frame -> True]


enter image description here

  • $\begingroup$ Your code is clear. Thanks! $\endgroup$
    – tanghe2014
    Commented Jan 9, 2017 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.