71.18.4 problem 4

Internal problem ID [14507]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 8. Linear Systems of First-Order Differential Equations. Exercises 8.3 page 379
Problem number : 4
Date solved : Monday, March 31, 2025 at 12:29:01 PM
CAS classification : system_of_ODEs

\begin{align*} \frac {d}{d x}y_{1} \left (x \right )&=2 x y_{1} \left (x \right )-x^{2} y_{2} \left (x \right )+4 x\\ \frac {d}{d x}y_{2} \left (x \right )&={\mathrm e}^{x} y_{1} \left (x \right )+3 \,{\mathrm e}^{-x} y_{2} \left (x \right )-\cos \left (3 x \right ) \end{align*}

Maple
ode:=[diff(y__1(x),x) = 2*x*y__1(x)-x^2*y__2(x)+4*x, diff(y__2(x),x) = exp(x)*y__1(x)+3*exp(-x)*y__2(x)-cos(3*x)]; 
dsolve(ode);
 
\[ \text {No solution found} \]
Mathematica
ode={D[ y1[x],x]==2*x*y1[x]-x^2*y2[x]+4*x,D[ y2[x],x]==Exp[x]*y1[x]+3*Exp[-x]*y2[x]-Cos[3*x]}; 
ic={}; 
DSolve[{ode,ic},{y1[x],y2[x]},x,IncludeSingularSolutions->True]
 

Not solved

Sympy
from sympy import * 
x = symbols("x") 
y__1 = Function("y__1") 
y__2 = Function("y__2") 
ode=[Eq(x**2*y__2(x) - 2*x*y__1(x) - 4*x + Derivative(y__1(x), x),0),Eq(-y__1(x)*exp(x) - 3*y__2(x)*exp(-x) + cos(3*x) + Derivative(y__2(x), x),0)] 
ics = {} 
dsolve(ode,func=[y__1(x),y__2(x)],ics=ics)
 
NotImplementedError :