12.10.28 problem 28

Internal problem ID [1832]
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 : 28
Date solved : Saturday, March 29, 2025 at 11:40:55 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

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