77.1.139 problem 166 (page 240)

Internal problem ID [17958]
Book : V.V. Stepanov, A course of differential equations (in Russian), GIFML. Moscow (1958)
Section : All content
Problem number : 166 (page 240)
Date solved : Monday, March 31, 2025 at 04:52:30 PM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

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

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