76.6.12 problem 12

Internal problem ID [17396]
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 : 12
Date solved : Monday, March 31, 2025 at 04:12:47 PM
CAS classification : system_of_ODEs

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

With initial conditions

\begin{align*} x \left (0\right ) = 1\\ y \left (0\right ) = -2 \end{align*}

Maple. Time used: 0.134 (sec). Leaf size: 42
ode:=[diff(x(t),t) = x(t)-4*y(t)+2*t, diff(y(t),t) = x(t)-3*y(t)-3]; 
ic:=x(0) = 1y(0) = -2; 
dsolve([ode,ic]);
 
\begin{align*} x \left (t \right ) &= -{\mathrm e}^{-t}+2 \,{\mathrm e}^{-t} t +6 t +2 \\ y \left (t \right ) &= -{\mathrm e}^{-t}+{\mathrm e}^{-t} t -1+2 t \\ \end{align*}
Mathematica. Time used: 0.07 (sec). Leaf size: 46
ode={D[x[t],t]==x[t]-4*y[t]+2*t,D[y[t],t]==x[t]-3*y[t]-3}; 
ic={x[0]==1,y[0]==-2}; 
DSolve[{ode,ic},{x[t],y[t]},t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)\to e^{-t} \left (2 t+e^t (6 t+2)-1\right ) \\ y(t)\to e^{-t} \left (t+e^t (2 t-1)-1\right ) \\ \end{align*}
Sympy. Time used: 0.163 (sec). Leaf size: 42
from sympy import * 
t = symbols("t") 
x = Function("x") 
y = Function("y") 
ode=[Eq(-2*t - x(t) + 4*y(t) + Derivative(x(t), t),0),Eq(-x(t) + 3*y(t) + Derivative(y(t), t) + 3,0)] 
ics = {} 
dsolve(ode,func=[x(t),y(t)],ics=ics)
 
\[ \left [ x{\left (t \right )} = 2 C_{1} t e^{- t} + 6 t + \left (C_{1} + 2 C_{2}\right ) e^{- t} + 2, \ y{\left (t \right )} = C_{1} t e^{- t} + C_{2} e^{- t} + 2 t - 1\right ] \]