76.1.21 problem 21

Internal problem ID [17249]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 2. First order differential equations. Section 2.1 (Separable equations). Problems at page 44
Problem number : 21
Date solved : Monday, March 31, 2025 at 03:46:17 PM
CAS classification : [_separable]

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

With initial conditions

\begin{align*} y \left (0\right )&=-\sqrt {3} \end{align*}

Maple. Time used: 0.122 (sec). Leaf size: 20
ode:=diff(y(x),x) = (1+y(x)^2)*tan(2*x); 
ic:=y(0) = -3^(1/2); 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = -\cot \left (\frac {\pi }{6}+\frac {\ln \left (\sec \left (2 x \right )^{2}\right )}{4}\right ) \]
Mathematica. Time used: 0.408 (sec). Leaf size: 21
ode=D[y[x],x]==(1+y[x]^2)*Tan[2*x]; 
ic={y[0]==-Sqrt[3]}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \cot \left (\frac {1}{6} (3 \log (\cos (2 x))+5 \pi )\right ) \]
Sympy. Time used: 0.441 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-(y(x)**2 + 1)*tan(2*x) + Derivative(y(x), x),0) 
ics = {y(0): -sqrt(3)} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = - \tan {\left (\frac {\log {\left (\cos {\left (2 x \right )} \right )}}{2} + \frac {\pi }{3} \right )} \]