47.5.1 problem 1

Internal problem ID [7490]
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 : 1
Date solved : Wednesday, March 05, 2025 at 04:40:02 AM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

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

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