2.12.3 Problem 40

2.12.3.1 Maple
2.12.3.2 Mathematica
2.12.3.3 Sympy

Internal problem ID [13402]
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 : 40
Date solved : Friday, December 19, 2025 at 03:54:02 AM
CAS classification : [_Riccati]

\begin{align*} y^{\prime }&=y^{2}-2 a b \cot \left (x a \right ) y+b^{2}-a^{2} \\ \end{align*}
Unknown ode type.
2.12.3.1 Maple. Time used: 0.002 (sec). Leaf size: 370
ode:=diff(y(x),x) = y(x)^2-2*a*b*cot(a*x)*y(x)+b^2-a^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (-\sin \left (a x \right )^{2} \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}+a \left (\left (b -\frac {1}{2}\right ) \cos \left (a x \right )^{2}-\frac {\sin \left (a x \right )^{2}}{2}-b +\frac {1}{2}\right )\right ) \cos \left (a x \right ) \operatorname {LegendreP}\left (\frac {-a +2 \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}}{2 a}, b -\frac {1}{2}, \cos \left (a x \right )\right )+c_1 \left (-\sin \left (a x \right )^{2} \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}+a \left (\left (b -\frac {1}{2}\right ) \cos \left (a x \right )^{2}-\frac {\sin \left (a x \right )^{2}}{2}-b +\frac {1}{2}\right )\right ) \cos \left (a x \right ) \operatorname {LegendreQ}\left (\frac {-a +2 \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}}{2 a}, b -\frac {1}{2}, \cos \left (a x \right )\right )-\left (-\sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}+\left (b -1\right ) a \right ) \sin \left (a x \right )^{2} \left (\operatorname {LegendreQ}\left (\frac {a +2 \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}}{2 a}, b -\frac {1}{2}, \cos \left (a x \right )\right ) c_1 +\operatorname {LegendreP}\left (\frac {a +2 \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}}{2 a}, b -\frac {1}{2}, \cos \left (a x \right )\right )\right )}{\sin \left (a x \right ) \left (\cos \left (a x \right )^{2}-1\right ) \left (\operatorname {LegendreQ}\left (\frac {-a +2 \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}}{2 a}, b -\frac {1}{2}, \cos \left (a x \right )\right ) c_1 +\operatorname {LegendreP}\left (\frac {-a +2 \sqrt {\left (b^{2}-1\right ) a^{2}+b^{2}}}{2 a}, b -\frac {1}{2}, \cos \left (a x \right )\right )\right )} \]

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: 
   trying Riccati_symmetries 
   trying Riccati to 2nd Order 
   -> Calling odsolve with the ODE, diff(diff(y(x),x),x) = -2*a*b*cot(a*x)*diff 
(y(x),x)+(a^2-b^2)*y(x), y(x) 
      *** Sublevel 2 *** 
      Methods for second order ODEs: 
      --- Trying classification methods --- 
      trying a symmetry of the form [xi=0, eta=F(x)] 
      checking if the LODE is missing y 
      -> Heun: Equivalence to the GHE or one of its 4 confluent cases under a \ 
power @ Moebius 
      -> trying a solution of the form r0(x) * Y + r1(x) * Y where Y = exp(int\ 
(r(x), dx)) * 2F1([a1, a2], [b1], f) 
      -> Trying changes of variables to rationalize or make the ODE simpler 
         trying a quadrature 
         checking if the LODE has constant coefficients 
         checking if the LODE is of Euler type 
         trying a symmetry of the form [xi=0, eta=F(x)] 
         checking if the LODE is missing y 
         -> Trying a Liouvillian solution using Kovacics algorithm 
         <- No Liouvillian solutions exists 
         -> Trying a solution in terms of special functions: 
            -> Bessel 
            -> elliptic 
            -> Legendre 
            -> Kummer 
               -> hyper3: Equivalence to 1F1 under a power @ Moebius 
            -> hypergeometric 
               -> heuristic approach 
               <- heuristic approach successful 
            <- hypergeometric successful 
         <- special function solution successful 
         Change of variables used: 
            [x = 1/a*arcsin(t)] 
         Linear ODE actually solved: 
            (-a^2*t+b^2*t)*u(t)+(-2*a^2*b*t^2-a^2*t^2+2*a^2*b)*diff(u(t),t)+(-a\ 
^2*t^3+a^2*t)*diff(diff(u(t),t),t) = 0 
      <- change of variables successful 
   <- Riccati to 2nd Order successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=y \left (x \right )^{2}-2 a b \cot \left (a x \right ) y \left (x \right )+b^{2}-a^{2} \\ \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 )=y \left (x \right )^{2}-2 a b \cot \left (a x \right ) y \left (x \right )+b^{2}-a^{2} \end {array} \]
2.12.3.2 Mathematica
ode=D[y[x],x]==y[x]^2-2*a*b*Cot[a*x]*y[x]+b^2-a^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 

Not solved

2.12.3.3 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
y = Function("y") 
ode = Eq(a**2 + 2*a*b*y(x)/tan(a*x) - b**2 - y(x)**2 + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE a**2 + 2*a*b*y(x)/tan(a*x) - b**2 - y(x)**2 + Derivative(y(x), x
 
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)) 
 
('lie_group',)