2.9.5 Problem 7

2.9.5.1 Solved using first_order_ode_riccati
2.9.5.2 Maple
2.9.5.3 Mathematica
2.9.5.4 Sympy

Internal problem ID [13371]
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-1. Equations with sine
Problem number : 7
Date solved : Sunday, January 18, 2026 at 07:34:22 PM
CAS classification : [_Riccati]

2.9.5.1 Solved using first_order_ode_riccati

40.569 (sec)

Entering first order ode riccati solver

\begin{align*} 2 y^{\prime }&=\left (\lambda +a -\sin \left (\lambda x \right ) a \right ) y^{2}+\lambda -a -\sin \left (\lambda x \right ) a \\ \end{align*}
In canonical form the ODE is
\begin{align*} y' &= F(x,y)\\ &= -\frac {\sin \left (\lambda x \right ) a y^{2}}{2}+\frac {a y^{2}}{2}+\frac {\lambda y^{2}}{2}+\frac {\lambda }{2}-\frac {a}{2}-\frac {\sin \left (\lambda x \right ) a}{2} \end{align*}

This is a Riccati ODE. Comparing the ODE to solve

\[ y' = -\frac {\sin \left (\lambda x \right ) a y^{2}}{2}+\frac {a y^{2}}{2}+\frac {\lambda y^{2}}{2}+\frac {\lambda }{2}-\frac {a}{2}-\frac {\sin \left (\lambda x \right ) a}{2} \]
With Riccati ODE standard form
\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]
Shows that \(f_0(x)=\frac {\lambda }{2}-\frac {a}{2}-\frac {\sin \left (\lambda x \right ) a}{2}\), \(f_1(x)=0\) and \(f_2(x)=-\frac {\sin \left (\lambda x \right ) a}{2}+\frac {a}{2}+\frac {\lambda }{2}\). Let
\begin{align*} y &= \frac {-u'}{f_2 u} \\ &= \frac {-u'}{u \left (-\frac {\sin \left (\lambda x \right ) a}{2}+\frac {a}{2}+\frac {\lambda }{2}\right )} \tag {1} \end{align*}

Using the above substitution in the given ODE results (after some simplification) in a second order ODE to solve for \(u(x)\) which is

\begin{align*} f_2 u''(x) -\left ( f_2' + f_1 f_2 \right ) u'(x) + f_2^2 f_0 u(x) &= 0 \tag {2} \end{align*}

But

\begin{align*} f_2' &=-\frac {\lambda \cos \left (\lambda x \right ) a}{2}\\ f_1 f_2 &=0\\ f_2^2 f_0 &=\left (-\frac {\sin \left (\lambda x \right ) a}{2}+\frac {a}{2}+\frac {\lambda }{2}\right )^{2} \left (\frac {\lambda }{2}-\frac {a}{2}-\frac {\sin \left (\lambda x \right ) a}{2}\right ) \end{align*}

Substituting the above terms back in equation (2) gives

\[ \left (-\frac {\sin \left (\lambda x \right ) a}{2}+\frac {a}{2}+\frac {\lambda }{2}\right ) u^{\prime \prime }\left (x \right )+\frac {\lambda \cos \left (\lambda x \right ) a u^{\prime }\left (x \right )}{2}+\left (-\frac {\sin \left (\lambda x \right ) a}{2}+\frac {a}{2}+\frac {\lambda }{2}\right )^{2} \left (\frac {\lambda }{2}-\frac {a}{2}-\frac {\sin \left (\lambda x \right ) a}{2}\right ) u \left (x \right ) = 0 \]
Unable to solve. Will ask Maple to solve this ode now.

The solution for \(u \left (x \right )\) is

\begin{equation} \tag{3} u \left (x \right ) = \frac {c_1 \sqrt {\sin \left (\lambda x \right )}\, \cos \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right ) {\mathrm e}^{\frac {2 \int \frac {\lambda \left (a +\lambda \right ) \cot \left (\lambda x \right )}{-2 \lambda -2 a +2 \sin \left (\lambda x \right ) a}d x \lambda -\sin \left (\lambda x \right ) a}{2 \lambda }}}{\sqrt {\sin \left (\lambda x \right ) a -a -\lambda }}+\frac {c_2 \sqrt {\sin \left (\lambda x \right )}\, \cos \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right ) \int _{}^{\sin \left (\lambda x \right )}\frac {\left (\left (-1+\textit {\_a} \right ) a -\lambda \right ) {\mathrm e}^{\frac {\textit {\_a} a}{\lambda }}}{\sqrt {\textit {\_a} +1}\, \left (-1+\textit {\_a} \right )^{{3}/{2}}}d \textit {\_a} {\mathrm e}^{\frac {2 \int \frac {\lambda \left (a +\lambda \right ) \cot \left (\lambda x \right )}{-2 \lambda -2 a +2 \sin \left (\lambda x \right ) a}d x \lambda -\sin \left (\lambda x \right ) a}{2 \lambda }}}{\sqrt {\sin \left (\lambda x \right ) a -a -\lambda }} \end{equation}
Taking derivative gives
\begin{equation} \tag{4} \text {Expression too large to display} \end{equation}
Substituting equations (3,4) into (1) results in
\begin{align*} y &= \frac {-u'}{f_2 u} \\ y &= \frac {-u'}{u \left (-\frac {\sin \left (\lambda x \right ) a}{2}+\frac {a}{2}+\frac {\lambda }{2}\right )} \\ y &= \text {Expression too large to display} \\ \end{align*}
Doing change of constants, the above solution becomes
\[ \text {Expression too large to display} \]

Summary of solutions found

\begin{align*} \text {Expression too large to display} \\ \end{align*}
2.9.5.2 Maple. Time used: 0.004 (sec). Leaf size: 220
ode:=2*diff(y(x),x) = (lambda+a-sin(lambda*x)*a)*y(x)^2+lambda-a-sin(lambda*x)*a; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {\operatorname {csgn}\left (\sin \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right )\right ) \left (\left (\cos \left (\lambda x \right ) a +\lambda \tan \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right )\right ) \left (\int _{}^{\sin \left (\lambda x \right )}\frac {\left (\left (\textit {\_a} -1\right ) a -\lambda \right ) {\mathrm e}^{\frac {a \textit {\_a}}{\lambda }}}{\left (\textit {\_a} -1\right )^{{3}/{2}} \sqrt {\textit {\_a} +1}}d \textit {\_a} c_1 +1\right ) \sqrt {-\cos \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right )^{2}}\, \operatorname {csgn}\left (\sin \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right )\right )+\frac {\cos \left (\lambda x \right ) {\mathrm e}^{\frac {a \sin \left (\lambda x \right )}{\lambda }} c_1 \sec \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right )^{2} \csc \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right ) \lambda \left (-\lambda -a +a \sin \left (\lambda x \right )\right )}{2}\right )}{\sqrt {-\cos \left (\frac {\pi }{4}+\frac {\lambda x}{2}\right )^{2}}\, \left (\int _{}^{\sin \left (\lambda x \right )}\frac {\left (\left (\textit {\_a} -1\right ) a -\lambda \right ) {\mathrm e}^{\frac {a \textit {\_a}}{\lambda }}}{\left (\textit {\_a} -1\right )^{{3}/{2}} \sqrt {\textit {\_a} +1}}d \textit {\_a} c_1 +1\right ) \left (-\lambda -a +a \sin \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 sub-methods: 
   trying Riccati_symmetries 
   trying Riccati to 2nd Order 
   -> Calling odsolve with the ODE, diff(diff(y(x),x),x) = a*lambda*cos(lambda* 
x)/(-lambda-a+a*sin(lambda*x))*diff(y(x),x)-1/4*(-lambda-a+a*sin(lambda*x))*(a* 
sin(lambda*x)+a-lambda)*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 symmetry of the form [xi=0, eta=F(x)] 
         checking if the LODE is missing y 
         -> Trying an equivalence, under non-integer power transformations, 
            to LODEs admitting Liouvillian solutions. 
            -> 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 
                  -> Whittaker 
                     -> hyper3: Equivalence to 1F1 under a power @ Moebius 
                  -> hypergeometric 
                     -> heuristic approach 
                     -> hyper3: Equivalence to 2F1, 1F1 or 0F1 under a power @\ 
 Moebius 
                  -> Mathieu 
                     -> Equivalence to the rational form of Mathieu ODE under \ 
a power @ Moebius 
                  -> Heun: Equivalence to the GHE or one of its 4 confluent cas\ 
es under a power @ Moebius 
               No special function solution was found. 
            <- Kovacics algorithm successful 
         <- Equivalence, under non-integer power transformations successful 
         Change of variables used: 
            [x = arccos(t)/lambda] 
         Linear ODE actually solved: 
            (8*lambda*a^2*(-t^2+1)^(1/2)+12*lambda^2*a*(-t^2+1)^(1/2)+4*a^3*t^2\ 
+12*a^2*lambda*t^2-8*a^2*lambda-4*a^3*(-t^2+1)^(1/2)*t^2-4*a*lambda^2-4*lambda^\ 
3)*u(t)+(16*a*lambda^2*t+16*lambda^3*t)*diff(u(t),t)+(-16*a*lambda^2*(-t^2+1)^(\ 
1/2)*t^2+16*a*lambda^2*t^2+16*lambda^3*t^2+16*lambda^2*a*(-t^2+1)^(1/2)-16*a*la\ 
mbda^2-16*lambda^3)*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} \\ {} & {} & 2 \frac {d}{d x}y \left (x \right )=\left (\lambda +a -a \sin \left (\lambda x \right )\right ) y \left (x \right )^{2}+\lambda -a -a \sin \left (\lambda 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 {\left (\lambda +a -a \sin \left (\lambda x \right )\right ) y \left (x \right )^{2}}{2}+\frac {\lambda }{2}-\frac {a}{2}-\frac {a \sin \left (\lambda x \right )}{2} \end {array} \]
2.9.5.3 Mathematica
ode=2*D[y[x],x]==(\[Lambda]+a-a*Sin[\[Lambda]*x])*y[x]^2+\[Lambda]-a-a*Sin[\[Lambda]*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 

Not solved

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