41.5.2 problem 2

Internal problem ID [8777]
Book : Ordinary differential equations and calculus of variations. Makarets and Reshetnyak. Wold Scientific. Singapore. 1995
Section : Chapter 2. Linear homogeneous equations. Section 2.3.4 problems. page 104
Problem number : 2
Date solved : Tuesday, September 30, 2025 at 05:50:46 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} x y^{\prime \prime }+x y^{\prime }-y&=x^{2}+2 x \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 22
ode:=x*diff(diff(y(x),x),x)+x*diff(y(x),x)-y(x) = x^2+2*x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -{\mathrm e}^{-x} c_2 +x \left (c_2 \,\operatorname {Ei}_{1}\left (x \right )+x +c_1 \right ) \]
Mathematica. Time used: 0.165 (sec). Leaf size: 77
ode=x*D[y[x],{x,2}]+x*D[y[x],x]-y[x]==x^2+2*x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x \left (\left (e^x x^2+c_2\right ) \int _1^x\frac {e^{-K[1]}}{K[1]^2}dK[1]+\int _1^x-e^{K[2]} K[2] (K[2]+2) \int _1^{K[2]}\frac {e^{-K[1]}}{K[1]^2}dK[1]dK[2]+c_1\right ) \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + x*Derivative(y(x), x) + x*Derivative(y(x), (x, 2)) - 2*x - y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -x + Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 2 - y(x)/x cannot be solved by the factorable group method