24.1.5 problem 1(e)

Internal problem ID [4194]
Book : Elementary Differential equations, Chaundy, 1969
Section : Exercises 3, page 60
Problem number : 1(e)
Date solved : Tuesday, March 04, 2025 at 05:55:24 PM
CAS classification : [_linear]

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

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