36.1.17 problem 17

Internal problem ID [6272]
Book : Fundamentals of Differential Equations. By Nagle, Saff and Snider. 9th edition. Boston. Pearson 2018.
Section : Chapter 2, First order differential equations. Section 2.2, Separable Equations. Exercises. page 46
Problem number : 17
Date solved : Wednesday, March 05, 2025 at 12:30:12 AM
CAS classification : [_separable]

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

With initial conditions

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

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