26.4.3 problem 2(c)

Internal problem ID [4271]
Book : Differential equations with applications and historial notes, George F. Simmons. Second edition. 1971
Section : Chapter 2, section 11, page 49
Problem number : 2(c)
Date solved : Tuesday, March 04, 2025 at 06:03:47 PM
CAS classification : [_linear]

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

Maple. Time used: 0.001 (sec). Leaf size: 17
ode:=(x^2+1)*diff(y(x),x)+2*x*y(x) = cot(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \frac {\ln \left (\sin \left (x \right )\right )+c_{1}}{x^{2}+1} \]
Mathematica. Time used: 0.044 (sec). Leaf size: 19
ode=(1+x^2)*D[y[x],x]+2*x*y[x]==Cot[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {\log (\sin (x))+c_1}{x^2+1} \]
Sympy. Time used: 0.502 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x*y(x) + (x**2 + 1)*Derivative(y(x), x) - 1/tan(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} - \frac {\log {\left (\frac {1}{\cos ^{2}{\left (x \right )}} \right )}}{2} + \log {\left (\tan {\left (x \right )} \right )}}{x^{2} + 1} \]