2.12.9 Problem 46

2.12.9.1 Solved using first_order_ode_riccati_by_guessing_particular_solution
2.12.9.2 Maple
2.12.9.3 Mathematica
2.12.9.4 Sympy

Internal problem ID [13408]
Book : Handbook of exact solutions for ordinary differential equations. By Polyanin and Zaitsev. Second edition
Section : Chapter 1, section 1.2. Riccati Equation. subsection 1.2.6-4. Equations with cotangent.
Problem number : 46
Date solved : Sunday, January 18, 2026 at 07:58:50 PM
CAS classification : [_Riccati]

2.12.9.1 Solved using first_order_ode_riccati_by_guessing_particular_solution

17.380 (sec)

Entering first order ode riccati guess solver

\begin{align*} \left (a \cot \left (\lambda x \right )+b \right ) y^{\prime }&=y^{2}+c \cot \left (\mu x \right ) y-d^{2}+c d \cot \left (\mu x \right ) \\ \end{align*}
This is a Riccati ODE. Comparing the above ODE to solve with the Riccati standard form
\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]
Shows that
\begin{align*} f_0(x) & =\frac {c d \cot \left (\mu x \right )}{a \cot \left (\lambda x \right )+b}-\frac {d^{2}}{a \cot \left (\lambda x \right )+b}\\ f_1(x) & =\frac {c \cot \left (\mu x \right )}{a \cot \left (\lambda x \right )+b}\\ f_2(x) &=\frac {1}{a \cot \left (\lambda x \right )+b} \end{align*}

Using trial and error, the following particular solution was found

\[ y_p = -d \]
Since a particular solution is known, then the general solution is given by
\begin{align*} y &= y_p + \frac { \phi (x) }{ c_1 - \int { \phi (x) f_2 \,dx} } \end{align*}

Where

\begin{align*} \phi (x) &= e^{ \int 2 f_2 y_p + f_1 \,dx } \end{align*}

Evaluating the above gives the general solution as

\[ y = -d +\frac {{\mathrm e}^{\frac {\left (-2 i d -c \right ) x}{i b -a}+\frac {2 c x}{i b -a}+\frac {i c \ln \left ({\mathrm e}^{2 i \mu x}-1\right )}{\left (i b -a \right ) \mu }+\int -\frac {2 a \left (2 i d \,{\mathrm e}^{2 i \mu x}+c \,{\mathrm e}^{2 i \mu x}-2 i d +c \right )}{\left (a \,{\mathrm e}^{2 i \lambda x}-i b \,{\mathrm e}^{2 i \lambda x}+a +i b \right ) \left (-i b \,{\mathrm e}^{2 i \mu x}+a \,{\mathrm e}^{2 i \mu x}+i b -a \right )}d x}}{c_1 -\int \frac {{\mathrm e}^{\frac {\left (-2 i d -c \right ) x}{i b -a}+\frac {2 c x}{i b -a}+\frac {i c \ln \left ({\mathrm e}^{2 i \mu x}-1\right )}{\left (i b -a \right ) \mu }+\int -\frac {2 a \left (2 i d \,{\mathrm e}^{2 i \mu x}+c \,{\mathrm e}^{2 i \mu x}-2 i d +c \right )}{\left (a \,{\mathrm e}^{2 i \lambda x}-i b \,{\mathrm e}^{2 i \lambda x}+a +i b \right ) \left (-i b \,{\mathrm e}^{2 i \mu x}+a \,{\mathrm e}^{2 i \mu x}+i b -a \right )}d x}}{a \cot \left (\lambda x \right )+b}d x} \]

Summary of solutions found

\begin{align*} y &= -d +\frac {{\mathrm e}^{\frac {\left (-2 i d -c \right ) x}{i b -a}+\frac {2 c x}{i b -a}+\frac {i c \ln \left ({\mathrm e}^{2 i \mu x}-1\right )}{\left (i b -a \right ) \mu }+\int -\frac {2 a \left (2 i d \,{\mathrm e}^{2 i \mu x}+c \,{\mathrm e}^{2 i \mu x}-2 i d +c \right )}{\left (a \,{\mathrm e}^{2 i \lambda x}-i b \,{\mathrm e}^{2 i \lambda x}+a +i b \right ) \left (-i b \,{\mathrm e}^{2 i \mu x}+a \,{\mathrm e}^{2 i \mu x}+i b -a \right )}d x}}{c_1 -\int \frac {{\mathrm e}^{\frac {\left (-2 i d -c \right ) x}{i b -a}+\frac {2 c x}{i b -a}+\frac {i c \ln \left ({\mathrm e}^{2 i \mu x}-1\right )}{\left (i b -a \right ) \mu }+\int -\frac {2 a \left (2 i d \,{\mathrm e}^{2 i \mu x}+c \,{\mathrm e}^{2 i \mu x}-2 i d +c \right )}{\left (a \,{\mathrm e}^{2 i \lambda x}-i b \,{\mathrm e}^{2 i \lambda x}+a +i b \right ) \left (-i b \,{\mathrm e}^{2 i \mu x}+a \,{\mathrm e}^{2 i \mu x}+i b -a \right )}d x}}{a \cot \left (\lambda x \right )+b}d x} \\ \end{align*}
2.12.9.2 Maple. Time used: 0.013 (sec). Leaf size: 366
ode:=(a*cot(lambda*x)+b)*diff(y(x),x) = y(x)^2+c*cot(mu*x)*y(x)-d^2+c*d*cot(mu*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-{\mathrm e}^{\frac {c \int \frac {\cot \left (\mu x \right )}{a \cot \left (\lambda x \right )+b}d x \lambda \left (a^{2}+b^{2}\right )-2 d b \left (\operatorname {arccot}\left (\cot \left (\lambda x \right )\right )-\frac {\pi }{2}\right )}{\lambda \left (a^{2}+b^{2}\right )}} \left (\csc \left (\lambda x \right )^{2}\right )^{-\frac {d a}{\lambda \left (a^{2}+b^{2}\right )}} \left (a \cot \left (\lambda x \right )+b \right )^{\frac {2 d a}{\lambda \left (a^{2}+b^{2}\right )}}-d \left (\int \left (a \cot \left (\lambda x \right )+b \right )^{\frac {\left (-a^{2}-b^{2}\right ) \lambda +2 a d}{\lambda \left (a^{2}+b^{2}\right )}} {\mathrm e}^{\frac {c \int \frac {\cot \left (\mu x \right )}{a \cot \left (\lambda x \right )+b}d x \lambda \left (a^{2}+b^{2}\right )-2 d b \left (\operatorname {arccot}\left (\cot \left (\lambda x \right )\right )-\frac {\pi }{2}\right )}{\lambda \left (a^{2}+b^{2}\right )}} \left (\csc \left (\lambda x \right )^{2}\right )^{-\frac {d a}{\lambda \left (a^{2}+b^{2}\right )}}d x -c_1 \right )}{\int \left (a \cot \left (\lambda x \right )+b \right )^{\frac {\left (-a^{2}-b^{2}\right ) \lambda +2 a d}{\lambda \left (a^{2}+b^{2}\right )}} {\mathrm e}^{\frac {c \int \frac {\cot \left (\mu x \right )}{a \cot \left (\lambda x \right )+b}d x \lambda \left (a^{2}+b^{2}\right )-2 d b \left (\operatorname {arccot}\left (\cot \left (\lambda x \right )\right )-\frac {\pi }{2}\right )}{\lambda \left (a^{2}+b^{2}\right )}} \left (\csc \left (\lambda x \right )^{2}\right )^{-\frac {d a}{\lambda \left (a^{2}+b^{2}\right )}}d x -c_1} \]

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
trying Bernoulli 
trying separable 
trying inverse linear 
trying homogeneous types: 
trying Chini 
differential order: 1; looking for linear symmetries 
trying exact 
Looking for potential symmetries 
trying Riccati 
trying Riccati sub-methods: 
   <- Riccati particular case Kamke (b) successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \left (a \cot \left (\lambda x \right )+b \right ) \left (\frac {d}{d x}y \left (x \right )\right )=y \left (x \right )^{2}+c \cot \left (\mu x \right ) y \left (x \right )-d^{2}+c d \cot \left (\mu x \right ) \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & \frac {d}{d x}y \left (x \right ) \\ \bullet & {} & \textrm {Solve for the highest derivative}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=\frac {y \left (x \right )^{2}+c \cot \left (\mu x \right ) y \left (x \right )-d^{2}+c d \cot \left (\mu x \right )}{a \cot \left (\lambda x \right )+b} \end {array} \]
2.12.9.3 Mathematica. Time used: 27.35 (sec). Leaf size: 799
ode=(a*Cot[\[Lambda]*x]+b)*D[y[x],x]==y[x]^2+c*Cot[\[Mu]*x]*y[x]-d^2+c*d*Cot[\[Mu]*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} \text {Solution too large to show}\end{align*}
2.12.9.4 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
c = symbols("c") 
d = symbols("d") 
lambda_ = symbols("lambda_") 
mu = symbols("mu") 
y = Function("y") 
ode = Eq(-c*d/tan(mu*x) - c*y(x)/tan(mu*x) + d**2 + (a/tan(lambda_*x) + b)*Derivative(y(x), x) - y(x)**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
TypeError : Invalid NaN comparison
 
Python version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] 
Sympy version 1.14.0
 
classify_ode(ode,func=y(x)) 
 
('factorable', 'lie_group')