2.4.66 Problem 63

Maple
Mathematica
Sympy

Internal problem ID [10229]
Book : Own collection of miscellaneous problems
Section : section 4.0
Problem number : 63
Date solved : Monday, December 01, 2025 at 08:42:02 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} \frac {x y^{\prime \prime }}{1-x}+y&=\cos \left (x \right ) \\ \end{align*}
Maple. Time used: 0.152 (sec). Leaf size: 168
ode:=x/(1-x)*diff(diff(y(x),x),x)+y(x) = cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -x \left (\left (-\operatorname {BesselI}\left (0, -x \right )-\operatorname {BesselI}\left (1, -x \right )\right ) \int -\frac {\cos \left (x \right ) \left (\operatorname {BesselK}\left (0, -x \right )-\operatorname {BesselK}\left (1, -x \right )\right ) \left (-1+x \right )}{-\operatorname {BesselK}\left (0, -x \right ) \operatorname {BesselI}\left (1, x\right ) x^{2}+\operatorname {BesselK}\left (1, -x \right ) \operatorname {BesselI}\left (0, x\right ) x^{2}+x +1}d x +\left (-\operatorname {BesselK}\left (0, -x \right )+\operatorname {BesselK}\left (1, -x \right )\right ) \int \frac {\cos \left (x \right ) \left (\operatorname {BesselI}\left (0, x\right )-\operatorname {BesselI}\left (1, x\right )\right ) \left (-1+x \right )}{-\operatorname {BesselK}\left (0, -x \right ) \operatorname {BesselI}\left (1, x\right ) x^{2}+\operatorname {BesselK}\left (1, -x \right ) \operatorname {BesselI}\left (0, x\right ) x^{2}+x +1}d x +c_1 \operatorname {BesselK}\left (1, -x \right )-c_1 \operatorname {BesselK}\left (0, -x \right )-c_2 \operatorname {BesselI}\left (0, -x \right )-c_2 \operatorname {BesselI}\left (1, -x \right )\right ) \]

Maple trace

Methods for second order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying high order exact linear fully integrable 
trying differential order: 2; linear nonhomogeneous with symmetry [0,1] 
trying a double symmetry of the form [xi=0, eta=F(x)] 
-> Try solving first the homogeneous part of the ODE 
   checking if the LODE has constant coefficients 
   checking if the LODE is of Euler type 
   trying a symmetry of the form [xi=0, eta=F(x)] 
   checking if the LODE is missing y 
   -> Trying a Liouvillian solution using Kovacics algorithm 
   <- No Liouvillian solutions exists 
   -> Trying a solution in terms of special functions: 
      -> Bessel 
      -> elliptic 
      -> Legendre 
      <- Kummer successful 
   <- special function solution successful 
<- solving first the homogeneous part of the ODE successful
 
Mathematica. Time used: 0.211 (sec). Leaf size: 133
ode=x/(1-x)*D[y[x],{x,2}]+y[x]==Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} x \left (\operatorname {HypergeometricU}\left (\frac {1}{2},2,2 x\right ) \int _1^x2 \sqrt {\pi } (\operatorname {BesselI}(0,K[1])-\operatorname {BesselI}(1,K[1])) \cos (K[1]) (K[1]-1)dK[1]+e^x (\operatorname {BesselI}(0,x)-\operatorname {BesselI}(1,x)) \int _1^x-2 e^{-K[2]} \sqrt {\pi } \cos (K[2]) \operatorname {HypergeometricU}\left (\frac {1}{2},2,2 K[2]\right ) (K[2]-1)dK[2]+c_1 \operatorname {HypergeometricU}\left (\frac {1}{2},2,2 x\right )+c_2 e^x \operatorname {BesselI}(0,x)-c_2 e^x \operatorname {BesselI}(1,x)\right ) \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), (x, 2))/(1 - x) + y(x) - cos(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : solve: Cannot solve x*Derivative(y(x), (x, 2))/(1 - x) + y(x) - cos(x)