29.7.19 problem 22

Internal problem ID [7336]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 7. Other second-Order equations. page 435
Problem number : 22
Date solved : Tuesday, September 30, 2025 at 04:29:11 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} x^{2} y^{\prime \prime }+x y^{\prime }+y&=2 x \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 16
ode:=x^2*diff(diff(y(x),x),x)+x*diff(y(x),x)+y(x) = 2*x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (\ln \left (x \right )\right ) c_2 +\cos \left (\ln \left (x \right )\right ) c_1 +x \]
Mathematica. Time used: 0.018 (sec). Leaf size: 52
ode=x^2*D[y[x],{x,2}]+x*D[y[x],x]+y[x]==2*x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \cos (\log (x)) \int _1^x-2 \sin (\log (K[1]))dK[1]+\sin (\log (x)) \int _1^x2 \cos (\log (K[2]))dK[2]+c_1 \cos (\log (x))+c_2 \sin (\log (x)) \end{align*}
Sympy. Time used: 0.133 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), (x, 2)) + x*Derivative(y(x), x) - 2*x + y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (\log {\left (x \right )} \right )} + C_{2} \cos {\left (\log {\left (x \right )} \right )} + x \]