4.20 How to solve set of differential equations in vector form

Given differential equations, written in vector form, as in \[ \begin {pmatrix} y'(t)\\ x'(t) \end {pmatrix} = \begin {pmatrix} f(t,y(t),x(t))\\ g(t,y(t),x(t)) \end {pmatrix} \]

How to solve them?

Reference: https://mathematica.stackexchange.com/questions/76713/dsolve-cannot-be-used-as-a-functtion

Maple

restart; 
A:=<1,0,0>; 
p:=t-> <p1(t),p2(t),p3(t)>: 
q:=t-> <q1(t),q2(t),q3(t)>: 
eq1:= diff~(p(t),t) = LinearAlgebra[CrossProduct](A,q(t));
 

\[ \left [ {\begin {array}{c} {\frac {\rm d}{{\rm d}t}}{\it p1} \left ( t \right ) \\ \noalign {\medskip }{\frac {\rm d}{{\rm d}t}}{\it p2} \left ( t \right ) \\ \noalign {\medskip }{\frac {\rm d}{{\rm d}t}}{\it p3} \left ( t \right ) \end {array}} \right ] = \left [ {\begin {array}{c} 0 \\ \noalign {\medskip }-{\it q3} \left ( t \right ) \\ \noalign {\medskip }{ \it q2} \left ( t \right ) \end {array}} \right ] \]

eq2:= diff~(q(t),t) = LinearAlgebra[CrossProduct](A,p(t));
 

\[ \left [ {\begin {array}{c} {\frac {\rm d}{{\rm d}t}}{\it q1} \left ( t \right ) \\ \noalign {\medskip }{\frac {\rm d}{{\rm d}t}}{\it q2} \left ( t \right ) \\ \noalign {\medskip }{\frac {\rm d}{{\rm d}t}}{\it q3} \left ( t \right ) \end {array}} \right ] = \left [ {\begin {array}{c} 0 \\ \noalign {\medskip }-{\it p3} \left ( t \right ) \\ \noalign {\medskip }{ \it p2} \left ( t \right ) \end {array}} \right ] \]

ic1:= p(0)=<0.5, 0.5, 0.3>;
 

\[ \left [ {\begin {array}{c} {\it p1} \left ( 0 \right ) \\ \noalign {\medskip }{\it p2} \left ( 0 \right ) \\ \noalign {\medskip }{ \it p3} \left ( 0 \right ) \end {array}} \right ] = \left [ {\begin {array} {c} 0.5\\ \noalign {\medskip } 0.5\\ \noalign {\medskip } 0.3\end {array}} \right ] \]

ic2:= q(0)=<0.1, 0.2, 0.3>;
 

\[ \left [ {\begin {array}{c} {\it q1} \left ( 0 \right ) \\ \noalign {\medskip }{\it q2} \left ( 0 \right ) \\ \noalign {\medskip }{ \it q3} \left ( 0 \right ) \end {array}} \right ] = \left [ {\begin {array} {c} 0.1\\ \noalign {\medskip } 0.2\\ \noalign {\medskip } 0.3\end {array}} \right ] \]

sol:=dsolve({eq1,eq2,ic1,ic2},convert(<p(t),q(t)>,Vector));
 

Notice in the above, the dependent variable had to be converted to one vector, hence the use of the convert() command. The result is

\[ \left [ {\begin {array}{c} {\it p1}(t) \\ \noalign {\medskip }{\it p2} \left ( t \right ) \\ \noalign {\medskip }{ \it p3} \left ( t \right ) \\ \noalign {\medskip }{\it q1} \left ( t \right ) \\ \noalign {\medskip }{\it q2} \left ( t \right ) \\ \noalign {\medskip }{\it q3} \left ( t \right ) \end {array}} \right ] = \left [ {\begin {array}{c} 1/2\\ \noalign {\medskip }-3/10\,\sin \left ( t \right ) +1/2\,\cos \left ( t \right ) \\ \noalign {\medskip }1/5\,\sin \left ( t \right ) +3/10\,\cos \left ( t \right ) \\ \noalign {\medskip }1/ 10\\ \noalign {\medskip }1/5\,\cos \left ( t \right ) -3/10\,\sin \left ( t \right ) \\ \noalign {\medskip }3/10\,\cos \left ( t \right ) +1/2\,\sin \left ( t \right ) \end {array}} \right ] \]

Mathematica

Clear[P, A, t] 
A = {1, 0, 0} 
P[t_] = {P1[t], P2[t], P3[t]} 
Q[t_] = {Q1[t], Q2[t], Q3[t]} 
sol = DSolve[{P'[t] == Cross[A, Q[t]], Q'[t] == Cross[A, P[t]], 
         P[0] == {0.5, 0.5, 0.3}, Q[0] == {0.1, 0.2, 0.3}}, 
  Flatten@{P[t], Q[t]}, t] 
MatrixForm@{sol}
 

\[ \left ( {\begin {array}{c} \left ( {\begin {array}{c} \text {P1}(t)\to 0.5 \\ \text {P2}(t)\to 0.5 \cos (t)-0.3 \sin (t) \\ \text {Q3}(t)\to 0.5 \sin (t)+0.3 \cos (t) \\ \text {P3}(t)\to 0.2 \sin (t)+0.3 \cos (t) \\ \text {Q2}(t)\to 0.2 \cos (t)-0.3 \sin (t) \\ \text {Q1}(t)\to 0.1 \\ \end {array}} \right ) \\ \end {array}} \right ) \]