12.2.8 problem 8

Internal problem ID [1544]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. Linear first order. Section 2.1 Page 41
Problem number : 8
Date solved : Saturday, March 29, 2025 at 10:58:21 PM
CAS classification : [_separable]

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

With initial conditions

\begin{align*} y \left (\frac {\pi }{2}\right )&=2 \end{align*}

Maple. Time used: 0.018 (sec). Leaf size: 11
ode:=x*diff(y(x),x)+(1+x*cot(x))*y(x) = 0; 
ic:=y(1/2*Pi) = 2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {\pi \csc \left (x \right )}{x} \]
Mathematica. Time used: 0.091 (sec). Leaf size: 66
ode=D[y[x],x] +(1+x*Cot[x])*y[x]==0; 
ic=y[Pi/2]==2; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to 2^{1+\frac {\pi }{2}} \left (1-e^{2 i x}\right )^{-x} \exp \left (-\frac {1}{12} i \left (-6 \operatorname {PolyLog}\left (2,e^{2 i x}\right )-6 x (x+2 i)+\pi ^2+6 i \pi \right )\right ) \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) + (x/tan(x) + 1)*y(x),0) 
ics = {y(pi/2): 2} 
dsolve(ode,func=y(x),ics=ics)
 
ValueError : Couldnt solve for initial conditions