76.17.18 problem 27

Internal problem ID [17625]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 4. Second order linear equations. Section 4.7 (Variation of parameters). Problems at page 280
Problem number : 27
Date solved : Thursday, March 13, 2025 at 10:45:27 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.228 (sec). Leaf size: 44
ode:=x^2*diff(diff(y(x),x),x)+x*diff(y(x),x)+(x^2-1/4)*y(x) = g(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\sin \left (x \right ) c_{2} +\cos \left (x \right ) c_{1} -\left (\int \frac {\sin \left (x \right ) g \left (x \right )}{x^{{3}/{2}}}d x \right ) \cos \left (x \right )+\left (\int \frac {\cos \left (x \right ) g \left (x \right )}{x^{{3}/{2}}}d x \right ) \sin \left (x \right )}{\sqrt {x}} \]
Mathematica. Time used: 0.076 (sec). Leaf size: 107
ode=x^2*D[y[x],{x,2}]+x*D[y[x],x]+(x^2-1/4)*y[x]==g[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {e^{-i x} \left (2 \int _1^x\frac {i e^{i K[1]} g(K[1])}{2 K[1]^{3/2}}dK[1]-i e^{2 i x} \int _1^x\frac {e^{-i K[2]} g(K[2])}{K[2]^{3/2}}dK[2]-i c_2 e^{2 i x}+2 c_1\right )}{2 \sqrt {x}} \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), (x, 2)) + x*Derivative(y(x), x) + (x**2 - 1/4)*y(x) - g(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE x*y(x) + x*Derivative(y(x), (x, 2)) + Derivative(y(x), x) - g(x)/x - y(x)/(4*x) cannot be solved by the factorable group method