2.6.6 Problem 23

2.6.6.1 Maple
2.6.6.2 Mathematica
2.6.6.3 Sympy

Internal problem ID [13341]
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.4-2. Equations with hyperbolic tangent and cotangent.
Problem number : 23
Date solved : Friday, December 19, 2025 at 03:10:39 AM
CAS classification : [_Riccati]

\begin{align*} y^{\prime }&=y^{2}-\lambda ^{2}+3 a \lambda -a \left (a +\lambda \right ) \coth \left (\lambda x \right )^{2} \\ \end{align*}
Unknown ode type.
2.6.6.1 Maple. Time used: 0.004 (sec). Leaf size: 148
ode:=diff(y(x),x) = y(x)^2-lambda^2+3*lambda*a-a*(a+lambda)*coth(lambda*x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-\left (a +\lambda \right ) \coth \left (\lambda x \right ) \left (c_1 \operatorname {LegendreQ}\left (\frac {a}{\lambda }, \frac {a -\lambda }{\lambda }, \coth \left (\lambda x \right )\right )+\operatorname {LegendreP}\left (\frac {a}{\lambda }, \frac {a -\lambda }{\lambda }, \coth \left (\lambda x \right )\right )\right )+2 c_1 \lambda \operatorname {LegendreQ}\left (\frac {a +\lambda }{\lambda }, \frac {a -\lambda }{\lambda }, \coth \left (\lambda x \right )\right )+2 \operatorname {LegendreP}\left (\frac {a +\lambda }{\lambda }, \frac {a -\lambda }{\lambda }, \coth \left (\lambda x \right )\right ) \lambda }{c_1 \operatorname {LegendreQ}\left (\frac {a}{\lambda }, \frac {a -\lambda }{\lambda }, \coth \left (\lambda x \right )\right )+\operatorname {LegendreP}\left (\frac {a}{\lambda }, \frac {a -\lambda }{\lambda }, \coth \left (\lambda x \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 Special 
trying Riccati sub-methods: 
   trying Riccati_symmetries 
   trying Riccati to 2nd Order 
   -> Calling odsolve with the ODE, diff(diff(y(x),x),x) = (a^2*coth(lambda*x)^ 
2+a*coth(lambda*x)^2*lambda-3*a*lambda+lambda^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 
            A Liouvillian solution exists 
            Reducible group (found an exponential solution) 
            Group is reducible, not completely reducible 
            Solution has integrals. Trying a special function solution free of \ 
integrals... 
            -> Trying a solution in terms of special functions: 
               -> Bessel 
               -> elliptic 
               -> Legendre 
               <- Legendre successful 
            <- special function solution successful 
               -> Trying to convert hypergeometric functions to elementary form\ 
... 
               <- elementary form could result into a too large expression - re\ 
turning special function form of solution, free of uncomputed integrals 
            <- Kovacics algorithm successful 
         Change of variables used: 
            [x = arccoth(t)/lambda] 
         Linear ODE actually solved: 
            (-a^2*t^2-a*lambda*t^2+3*a*lambda-lambda^2)*u(t)+(2*lambda^2*t^3-2*\ 
lambda^2*t)*diff(u(t),t)+(lambda^2*t^4-2*lambda^2*t^2+lambda^2)*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}-\lambda ^{2}+3 a \lambda -a \left (a +\lambda \right ) \coth \left (\lambda x \right )^{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}-\lambda ^{2}+3 a \lambda -a \left (a +\lambda \right ) \coth \left (\lambda x \right )^{2} \end {array} \]
2.6.6.2 Mathematica. Time used: 4.778 (sec). Leaf size: 496
ode=D[y[x],x]==y[x]^2-\[Lambda]^2+3*a*\[Lambda]-a*(a+\[Lambda])*Coth[\[Lambda]*x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {\int \frac {2 \lambda e^{-2 \lambda x} \left (a \left (2 e^{2 \lambda x}-e^{4 \lambda x}+1\right )+\lambda \left (2 e^{2 \lambda x}+e^{4 \lambda x}-1\right )\right )}{e^{4 \lambda x}-1} \, de^{2 \lambda x}}{2 \lambda }+\frac {2 \lambda \exp \left (\int _1^{e^{2 x \lambda }}\frac {a (K[1]+1)^2-2 \lambda (K[1]-1) K[1]}{\lambda K[1] \left (K[1]^2-1\right )}dK[1]+2 \lambda x\right )-2 \lambda \exp \left (\int _1^{e^{2 x \lambda }}\frac {a (K[1]+1)^2-2 \lambda (K[1]-1) K[1]}{\lambda K[1] \left (K[1]^2-1\right )}dK[1]+6 \lambda x\right )+\left (a \left (e^{2 \lambda x}+1\right )^2-\lambda \left (e^{2 \lambda x}-1\right )^2\right ) \int _1^{e^{2 x \lambda }}\exp \left (\int _1^{K[2]}\frac {a (K[1]+1)^2-2 \lambda (K[1]-1) K[1]}{\lambda K[1] \left (K[1]^2-1\right )}dK[1]\right )dK[2]+c_1 (a-\lambda )-c_1 (\lambda -a) e^{4 \lambda x}+2 c_1 (a+\lambda ) e^{2 \lambda x}}{\left (e^{4 \lambda x}-1\right ) \left (\int _1^{e^{2 x \lambda }}\exp \left (\int _1^{K[2]}\frac {a (K[1]+1)^2-2 \lambda (K[1]-1) K[1]}{\lambda K[1] \left (K[1]^2-1\right )}dK[1]\right )dK[2]+c_1\right )}\\ y(x)&\to \frac {a \left (e^{2 \lambda x}+1\right )^2-\lambda \left (e^{2 \lambda x}-1\right )^2}{e^{4 \lambda x}-1}-\frac {\int \frac {2 \lambda e^{-2 \lambda x} \left (a \left (2 e^{2 \lambda x}-e^{4 \lambda x}+1\right )+\lambda \left (2 e^{2 \lambda x}+e^{4 \lambda x}-1\right )\right )}{e^{4 \lambda x}-1} \, de^{2 \lambda x}}{2 \lambda } \end{align*}
2.6.6.3 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
lambda_ = symbols("lambda_") 
y = Function("y") 
ode = Eq(-3*a*lambda_ + a*(a + lambda_)/tanh(lambda_*x)**2 + lambda_**2 - y(x)**2 + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE a**2/tanh(lambda_*x)**2 - 3*a*lambda_ + a*lambda_/tanh(lambda_*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)) 
 
('factorable', 'lie_group')