76.6.17 problem 19

Internal problem ID [17401]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 3. Systems of two first order equations. Section 3.2 (Two first order linear differential equations). Problems at page 142
Problem number : 19
Date solved : Monday, March 31, 2025 at 04:12:55 PM
CAS classification : system_of_ODEs

\begin{align*} \frac {d}{d t}x \left (t \right )&=x \left (t \right )+y \left (t \right )-3\\ \frac {d}{d t}y \left (t \right )&=-x \left (t \right )+y \left (t \right )+1 \end{align*}

Maple. Time used: 0.137 (sec). Leaf size: 36
ode:=[diff(x(t),t) = x(t)+y(t)-3, diff(y(t),t) = -x(t)+y(t)+1]; 
dsolve(ode);
 
\begin{align*} x \left (t \right ) &= 2+{\mathrm e}^{t} \left (\cos \left (t \right ) c_1 +\sin \left (t \right ) c_2 \right ) \\ y \left (t \right ) &= 1+{\mathrm e}^{t} \left (\cos \left (t \right ) c_2 -\sin \left (t \right ) c_1 \right ) \\ \end{align*}
Mathematica. Time used: 0.048 (sec). Leaf size: 146
ode={D[x[t],t]==x[t]+y[t]-3,D[y[t],t]==-x[t]+y[t]+1}; 
ic={}; 
DSolve[{ode,ic},{x[t],y[t]},t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)\to e^t \left (\cos (t) \int _1^t-e^{-K[1]} (3 \cos (K[1])+\sin (K[1]))dK[1]+\sin (t) \int _1^te^{-K[2]} (\cos (K[2])-3 \sin (K[2]))dK[2]+c_1 \cos (t)+c_2 \sin (t)\right ) \\ y(t)\to e^t \left (\cos (t) \int _1^te^{-K[2]} (\cos (K[2])-3 \sin (K[2]))dK[2]-\sin (t) \int _1^t-e^{-K[1]} (3 \cos (K[1])+\sin (K[1]))dK[1]+c_2 \cos (t)-c_1 \sin (t)\right ) \\ \end{align*}
Sympy. Time used: 0.275 (sec). Leaf size: 61
from sympy import * 
t = symbols("t") 
x = Function("x") 
y = Function("y") 
ode=[Eq(-x(t) - y(t) + Derivative(x(t), t) + 3,0),Eq(x(t) - y(t) + Derivative(y(t), t) - 1,0)] 
ics = {} 
dsolve(ode,func=[x(t),y(t)],ics=ics)
 
\[ \left [ x{\left (t \right )} = C_{1} e^{t} \sin {\left (t \right )} + C_{2} e^{t} \cos {\left (t \right )} + 2 \sin ^{2}{\left (t \right )} + 2 \cos ^{2}{\left (t \right )}, \ y{\left (t \right )} = C_{1} e^{t} \cos {\left (t \right )} - C_{2} e^{t} \sin {\left (t \right )} + \sin ^{2}{\left (t \right )} + \cos ^{2}{\left (t \right )}\right ] \]