18.1.8 problem Problem 14.5 (b)

Internal problem ID [3464]
Book : Mathematical methods for physics and engineering, Riley, Hobson, Bence, second edition, 2002
Section : Chapter 14, First order ordinary differential equations. 14.4 Exercises, page 490
Problem number : Problem 14.5 (b)
Date solved : Tuesday, March 04, 2025 at 04:40:23 PM
CAS classification : [_linear]

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

Maple. Time used: 0.000 (sec). Leaf size: 11
ode:=diff(y(x),x)-y(x)*cot(x)+1/sin(x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = c_{1} \sin \left (x \right )+\cos \left (x \right ) \]
Mathematica. Time used: 0.045 (sec). Leaf size: 13
ode=D[y[x],x]-y[x]*Cot[x]+1/Sin[x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \cos (x)+c_1 \sin (x) \]
Sympy. Time used: 0.843 (sec). Leaf size: 10
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x)/tan(x) + Derivative(y(x), x) + 1/sin(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + \cos {\left (x \right )} \]