18.2.17 problem Problem 15.35

Internal problem ID [3500]
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.35
Date solved : Sunday, March 30, 2025 at 01:45:06 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

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