7.4.19 problem 19

Internal problem ID [91]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 1. First order differential equations. Section 1.5 (linear equations). Problems at page 54
Problem number : 19
Date solved : Tuesday, March 04, 2025 at 10:42:52 AM
CAS classification : [_linear]

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

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