44.11.8 problem 2(b)

Internal problem ID [9278]
Book : Differential Equations: Theory, Technique, and Practice by George Simmons, Steven Krantz. McGraw-Hill NY. 2007. 1st Edition.
Section : Chapter 2. Second-Order Linear Equations. Section 2.3. THE METHOD OF VARIATION OF PARAMETERS. Page 71
Problem number : 2(b)
Date solved : Tuesday, September 30, 2025 at 06:16:01 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=\cot \left (x \right )^{2} \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)+y(x) = cot(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 -2-\cos \left (x \right ) \ln \left (\csc \left (x \right )-\cot \left (x \right )\right ) \]
Mathematica. Time used: 0.036 (sec). Leaf size: 41
ode=D[y[x],{x,2}]+y[x]==Cot[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \cos (x) \int _1^x-\cos (K[1]) \cot (K[1])dK[1]-\sin ^2(x)+c_1 \cos (x)+c_2 \sin (x)-1 \end{align*}
Sympy. Time used: 0.224 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) + Derivative(y(x), (x, 2)) - 1/tan(x)**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \sin {\left (x \right )} + \left (C_{1} - \frac {\log {\left (\cos {\left (x \right )} - 1 \right )}}{2} + \frac {\log {\left (\cos {\left (x \right )} + 1 \right )}}{2}\right ) \cos {\left (x \right )} - 2 \]