35.7.15 problem 18

Internal problem ID [6197]
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 : 18
Date solved : Wednesday, March 05, 2025 at 12:24:22 AM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

\begin{align*} x^{2} y^{\prime \prime }+x y^{\prime }-y&=x -\frac {1}{x} \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 31
ode:=x^2*diff(diff(y(x),x),x)+x*diff(y(x),x)-y(x) = x-1/x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {2 \ln \left (x \right ) x^{2}+4 c_{2} x^{2}+2 \ln \left (x \right )+4 c_{1} +1}{4 x} \]
Mathematica. Time used: 0.049 (sec). Leaf size: 36
ode=x^2*D[y[x],{x,2}]+x*D[y[x],x]-y[x]==x-1/x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {2 \left (x^2+1\right ) \log (x)+4 (-1+c_2) x^2+3+4 c_1}{4 x} \]
Sympy. Time used: 0.282 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), (x, 2)) + x*Derivative(y(x), x) - x - y(x) + 1/x,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} + x^{2} \left (C_{2} + \log {\left (x \right )}\right ) + \log {\left (x \right )}}{2 x} \]