18.2.11 problem Problem 15.22

Internal problem ID [3494]
Book : Mathematical methods for physics and engineering, Riley, Hobson, Bence, second edition, 2002
Section : Chapter 15, Higher order ordinary differential equations. 15.4 Exercises, page 523
Problem number : Problem 15.22
Date solved : Sunday, March 30, 2025 at 01:44:55 AM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.002 (sec). Leaf size: 39
ode:=(1+x)^2*diff(diff(y(x),x),x)+3*(1+x)*diff(y(x),x)+y(x) = x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (18 c_1 -6\right ) \ln \left (x +1\right )+2 x^{3}-3 x^{2}+6 x +18 c_2}{18 x +18} \]
Mathematica. Time used: 0.048 (sec). Leaf size: 44
ode=(x+1)^2*D[y[x],{x,2}]+3*(x+1)*D[y[x],x]+y[x]==x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {2 x^3-3 x^2+6 x+6 (-1+3 c_2) \log (x+1)+18 c_1}{18 (x+1)} \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + (x + 1)**2*Derivative(y(x), (x, 2)) + (3*x + 3)*Derivative(y(x), x) + y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE Derivative(y(x), x) - (-x**2*Derivative(y(x), (x, 2)) + x**2 - 2*x*Derivative(y(x), (x, 2)) - y(x) - Derivative(y(x), (x, 2)))/(3*(x + 1)) cannot be solved by the factorable group method