77.41.5 problem 2 (iv)

Internal problem ID [20769]
Book : A Text book for differentional equations for postgraduate students by Ray and Chaturvedi. First edition, 1958. BHASKAR press. INDIA
Section : Chapter VIII. Linear equations of second order. Excercise at end of chapter VIII. Page 141
Problem number : 2 (iv)
Date solved : Thursday, October 02, 2025 at 06:23:01 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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