12.10.33 problem 33

Internal problem ID [1837]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 5 linear second order equations. Section 5.7 Variation of Parameters. Page 262
Problem number : 33
Date solved : Saturday, March 29, 2025 at 11:41:04 PM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

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

With initial conditions

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

Maple. Time used: 0.146 (sec). Leaf size: 67
ode:=(x-1)^2*diff(diff(y(x),x),x)+4*x*diff(y(x),x)+2*y(x) = 2*x; 
ic:=y(0) = 0, D(y)(0) = -2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {x^{3}+28 \,{\mathrm e}^{\frac {4}{x -1}} \operatorname {Ei}_{1}\left (\frac {4}{x -1}\right )-28 \,{\mathrm e}^{\frac {4}{x -1}} \operatorname {Ei}_{1}\left (-4\right )-7 \,{\mathrm e}^{\frac {4 x}{x -1}}-2 x^{2}-6 x +7}{3 \left (x -1\right )^{2}} \]
Mathematica. Time used: 0.205 (sec). Leaf size: 71
ode=(x-1)^2*D[y[x],{x,2}]+4*x*D[y[x],x]+2*y[x]==2*x; 
ic={y[0]==0,Derivative[1][y][0] ==-2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {-28 e^{\frac {4}{x-1}} \operatorname {ExpIntegralEi}\left (-\frac {4}{x-1}\right )+28 \operatorname {ExpIntegralEi}(4) e^{\frac {4}{x-1}}+x^3-2 x^2-6 x-7 e^{\frac {4 x}{x-1}}+7}{3 (x-1)^2} \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*x*Derivative(y(x), x) - 2*x + (x - 1)**2*Derivative(y(x), (x, 2)) + 2*y(x),0) 
ics = {y(0): 0, Subs(Derivative(y(x), x), x, 0): -2} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE Derivative(y(x), x) - (x*(-x*Derivative(y(x), (x, 2)) + 2*Derivative(y(x), (x, 2)) + 2) - 2*y(x) - Derivative(y(x), (x, 2)))/(4*x) cannot be solved by the factorable group method