78.8.13 problem 13

Internal problem ID [18132]
Book : DIFFERENTIAL EQUATIONS WITH APPLICATIONS AND HISTORICAL NOTES by George F. Simmons. 3rd edition. 2017. CRC press, Boca Raton FL.
Section : Chapter 2. First order equations. Miscellaneous Problems for Chapter 2. Problems at page 99
Problem number : 13
Date solved : Thursday, March 13, 2025 at 11:40:07 AM
CAS classification : [_linear]

\begin{align*} x y^{\prime }+y&=x^{2} \cos \left (x \right ) \end{align*}

Maple. Time used: 0.001 (sec). Leaf size: 25
ode:=x*diff(y(x),x)+y(x) = x^2*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {x^{2} \sin \left (x \right )-2 \sin \left (x \right )+2 x \cos \left (x \right )+c_{1}}{x} \]
Mathematica. Time used: 0.052 (sec). Leaf size: 25
ode=x*D[y[x],x]+y[x]==x^2*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {\left (x^2-2\right ) \sin (x)+2 x \cos (x)+c_1}{x} \]
Sympy. Time used: 0.353 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*cos(x) + x*Derivative(y(x), x) + y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1}}{x} + x \sin {\left (x \right )} + 2 \cos {\left (x \right )} - \frac {2 \sin {\left (x \right )}}{x} \]