20.3.25 problem Problem 32

Internal problem ID [3634]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 1, First-Order Differential Equations. Section 1.6, First-Order Linear Differential Equations. page 59
Problem number : Problem 32
Date solved : Tuesday, March 04, 2025 at 04:55:25 PM
CAS classification : [_linear]

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

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