62.30.2 problem Ex 2

Internal problem ID [12887]
Book : An elementary treatise on differential equations by Abraham Cohen. DC heath publishers. 1906
Section : Chapter VIII, Linear differential equations of the second order. Article 53. Change of dependent variable. Page 125
Problem number : Ex 2
Date solved : Wednesday, March 05, 2025 at 08:49:48 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

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