ODE
\[ a^2 y(x)+y''(x)=\cot (a x) \] ODE Classification
[[_2nd_order, _linear, _nonhomogeneous]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.0358404 (sec), leaf count = 46
\[\left \{\left \{y(x)\to \frac {\sin (a x) \left (a^2 c_2+\log \left (\sin \left (\frac {a x}{2}\right )\right )-\log \left (\cos \left (\frac {a x}{2}\right )\right )\right )}{a^2}+c_1 \cos (a x)\right \}\right \}\]
Maple ✓
cpu = 0.182 (sec), leaf count = 41
\[ \left \{ y \left ( x \right ) =\sin \left ( ax \right ) {\it \_C2}+\cos \left ( ax \right ) {\it \_C1}+{\frac {\sin \left ( ax \right ) }{{a}^{2}}\ln \left ( {\frac {1-\cos \left ( ax \right ) }{\sin \left ( ax \right ) }} \right ) } \right \} \] Mathematica raw input
DSolve[a^2*y[x] + y''[x] == Cot[a*x],y[x],x]
Mathematica raw output
{{y[x] -> C[1]*Cos[a*x] + ((a^2*C[2] - Log[Cos[(a*x)/2]] + Log[Sin[(a*x)/2]])*Si
n[a*x])/a^2}}
Maple raw input
dsolve(diff(diff(y(x),x),x)+a^2*y(x) = cot(a*x), y(x),'implicit')
Maple raw output
y(x) = sin(a*x)*_C2+cos(a*x)*_C1+sin(a*x)*ln((1-cos(a*x))/sin(a*x))/a^2