28.1.3 problem 3

Internal problem ID [4309]
Book : Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
Section : Chapter 2. First-Order and Simple Higher-Order Differential Equations. Page 78
Problem number : 3
Date solved : Tuesday, March 04, 2025 at 06:19:53 PM
CAS classification : [_separable]

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

Maple. Time used: 0.012 (sec). Leaf size: 77
ode:=x*cos(y(x))^2+exp(x)*tan(y(x))*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y \left (x \right ) &= \pi -\operatorname {arccot}\left (\frac {\sqrt {2}\, \sqrt {{\mathrm e}^{x} \left (x +1-{\mathrm e}^{x} c_{1} \right )}}{2 x +2-2 \,{\mathrm e}^{x} c_{1}}\right ) \\ y \left (x \right ) &= \frac {\pi }{2}-\arctan \left (\frac {\sqrt {2}\, \sqrt {{\mathrm e}^{x} \left (x +1-{\mathrm e}^{x} c_{1} \right )}}{2 x +2-2 \,{\mathrm e}^{x} c_{1}}\right ) \\ \end{align*}
Mathematica. Time used: 15.004 (sec). Leaf size: 149
ode=x*Cos[y[x]]^2+Exp[x]*Tan[y[x]]*D[y[x],x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -\sec ^{-1}\left (-\sqrt {2} \sqrt {e^{-x} \left (x+4 c_1 e^x+1\right )}\right ) \\ y(x)\to \sec ^{-1}\left (-\sqrt {2} \sqrt {e^{-x} \left (x+4 c_1 e^x+1\right )}\right ) \\ y(x)\to -\sec ^{-1}\left (\sqrt {2} \sqrt {e^{-x} \left (x+4 c_1 e^x+1\right )}\right ) \\ y(x)\to \sec ^{-1}\left (\sqrt {2} \sqrt {e^{-x} \left (x+4 c_1 e^x+1\right )}\right ) \\ y(x)\to -\frac {\pi }{2} \\ y(x)\to \frac {\pi }{2} \\ \end{align*}
Sympy. Time used: 4.191 (sec). Leaf size: 112
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*cos(y(x))**2 + exp(x)*tan(y(x))*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = - \operatorname {acos}{\left (- \frac {\sqrt {2} \sqrt {\frac {e^{x}}{C_{1} e^{x} + x + 1}}}{2} \right )} + 2 \pi , \ y{\left (x \right )} = - \operatorname {acos}{\left (\frac {\sqrt {2} \sqrt {\frac {e^{x}}{C_{1} e^{x} + x + 1}}}{2} \right )} + 2 \pi , \ y{\left (x \right )} = \operatorname {acos}{\left (- \frac {\sqrt {2} \sqrt {\frac {e^{x}}{C_{1} e^{x} + x + 1}}}{2} \right )}, \ y{\left (x \right )} = \operatorname {acos}{\left (\frac {\sqrt {2} \sqrt {\frac {e^{x}}{C_{1} e^{x} + x + 1}}}{2} \right )}\right ] \]