24.1.3 problem 1(c)

Internal problem ID [4192]
Book : Elementary Differential equations, Chaundy, 1969
Section : Exercises 3, page 60
Problem number : 1(c)
Date solved : Sunday, March 30, 2025 at 02:42:08 AM
CAS classification : [_linear]

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

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