# How do you use DSolve with Vector?

I'm trying to create an ODE for motion in 2 dimensions. What I have so far is:

x0 = {1.5, -4.};
v = {0, 8};
DSolve[{x'[t] == v, x == x0}, x[t], t]


This works with one dimension, but when I try and expand the idea for a vector/matrix, I get:

DSolve::nolist: List encountered within {(x^\[Prime])[t]=={0,8}}. There should be no lists on either side of the equations.

How do I fix this?

• NDSolve works without problems: NDSolve[{x'[t] == {0, 8}, x == {1.5, -4.}}, x , {t, 0, 1}] – Ulrich Neumann Dec 22 '19 at 15:56
• Yeah, I haven't quite figured out why NDSolve is smart enough to deal with a list, but DSolve can't. – Quarkly Dec 22 '19 at 16:01
• Nor am I , mysterious! – Ulrich Neumann Dec 22 '19 at 16:06

MMa doesn't know x[t] is a vector, so try this.

x0 = {1.5, -4.};
v = {0, 8};
x[t_] = {x1[t], x2[t]}

eq = x'[t] == v // Thread
(*{x1'[t] == 0, x2'[t] == 8}*)

init = x == x0 // Thread
(*{x1 == 1.5, x2 == -4.}*)

DSolve[{eq, init}, x[t], t]
(*{{x1[t] -> 1.5, x2[t] -> 8 t - 4.}}*)

x[t] /. %
(*{{1.5, 8 t - 4.}}*)

• This doesn't work. The velocity equation resolves to ${Derivative[x][t] == 0, Derivative[x][t] == 8}$ and thus DSolve doesn't have enough dependent variables to solve. – Quarkly Dec 22 '19 at 0:42
• The threading doesn't do what your comments suggest they should do. – Quarkly Dec 22 '19 at 0:54
• Corrected. I had mistakenly commented out the x[t] equation. Now changed the init to x0. Should work for you. – Bill Watts Dec 22 '19 at 0:58
• You must not have the x array assigned. – Bill Watts Dec 22 '19 at 2:31
• @Quarkly it worked for me – b3m2a1 Dec 22 '19 at 10:36