2.3.14 Problem 14

2.3.14.1 Solved using first_order_ode_riccati
2.3.14.2 Maple
2.3.14.3 Mathematica
2.3.14.4 Sympy

Internal problem ID [13294]
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.3. Equations Containing Exponential Functions
Problem number : 14
Date solved : Wednesday, December 31, 2025 at 01:01:59 PM
CAS classification : [_Riccati]

2.3.14.1 Solved using first_order_ode_riccati

10.822 (sec)

Entering first order ode riccati solver

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

This is a Riccati ODE. Comparing the ODE to solve

\[ y' = \textit {the\_rhs} \]
With Riccati ODE standard form
\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]
Shows that \(f_0(x)=-a \,{\mathrm e}^{-\lambda x} {\mathrm e}^{\mu x}\), \(f_1(x)={\mathrm e}^{\mu x} a\) and \(f_2(x)=-\lambda \,{\mathrm e}^{\lambda x}\). Let
\begin{align*} y &= \frac {-u'}{f_2 u} \\ &= \frac {-u'}{-u \lambda \,{\mathrm e}^{\lambda x}} \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' &=-\lambda ^{2} {\mathrm e}^{\lambda x}\\ f_1 f_2 &=-{\mathrm e}^{\lambda x} a \lambda \,{\mathrm e}^{\mu x}\\ f_2^2 f_0 &=-\lambda ^{2} {\mathrm e}^{\lambda x} a \,{\mathrm e}^{\mu x} \end{align*}

Substituting the above terms back in equation (2) gives

\[ -\lambda \,{\mathrm e}^{\lambda x} u^{\prime \prime }\left (x \right )-\left (-\lambda ^{2} {\mathrm e}^{\lambda x}-{\mathrm e}^{\lambda x} a \lambda \,{\mathrm e}^{\mu x}\right ) u^{\prime }\left (x \right )-\lambda ^{2} {\mathrm e}^{\lambda x} a \,{\mathrm e}^{\mu x} 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 ) = c_1 \,{\mathrm e}^{\lambda x}+c_2 \operatorname {hypergeom}\left (\left [-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right ) \end{equation}
Taking derivative gives
\begin{equation} \tag{4} u^{\prime }\left (x \right ) = c_1 \lambda \,{\mathrm e}^{\lambda x}-\frac {c_2 \lambda \operatorname {hypergeom}\left (\left [1-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }+1\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right ) {\mathrm e}^{\mu x} a}{\mu -\lambda } \end{equation}
Substituting equations (3,4) into (1) results in
\begin{align*} y &= \frac {-u'}{f_2 u} \\ y &= \frac {-u'}{-u \lambda \,{\mathrm e}^{\lambda x}} \\ y &= \frac {\left (c_1 \lambda \,{\mathrm e}^{\lambda x}-\frac {c_2 \lambda \operatorname {hypergeom}\left (\left [1-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }+1\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right ) {\mathrm e}^{\mu x} a}{\mu -\lambda }\right ) {\mathrm e}^{-\lambda x}}{\lambda \left (c_1 \,{\mathrm e}^{\lambda x}+c_2 \operatorname {hypergeom}\left (\left [-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right )\right )} \\ \end{align*}
Doing change of constants, the above solution becomes
\[ y = \frac {\left (\lambda \,{\mathrm e}^{\lambda x}-\frac {c_3 \lambda \operatorname {hypergeom}\left (\left [1-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }+1\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right ) {\mathrm e}^{\mu x} a}{\mu -\lambda }\right ) {\mathrm e}^{-\lambda x}}{\lambda \left ({\mathrm e}^{\lambda x}+c_3 \operatorname {hypergeom}\left (\left [-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right )\right )} \]
Simplifying the above gives
\begin{align*} y &= \frac {\operatorname {hypergeom}\left (\left [\frac {\mu -\lambda }{\mu }\right ], \left [\frac {-\lambda +2 \mu }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right ) a c_3 \,{\mathrm e}^{\left (\mu -\lambda \right ) x}+\lambda -\mu }{\left (\lambda -\mu \right ) \left ({\mathrm e}^{\lambda x}+c_3 \operatorname {hypergeom}\left (\left [-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right )\right )} \\ \end{align*}

Summary of solutions found

\begin{align*} y &= \frac {\operatorname {hypergeom}\left (\left [\frac {\mu -\lambda }{\mu }\right ], \left [\frac {-\lambda +2 \mu }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right ) a c_3 \,{\mathrm e}^{\left (\mu -\lambda \right ) x}+\lambda -\mu }{\left (\lambda -\mu \right ) \left ({\mathrm e}^{\lambda x}+c_3 \operatorname {hypergeom}\left (\left [-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right )\right )} \\ \end{align*}
2.3.14.2 Maple. Time used: 0.002 (sec). Leaf size: 96
ode:=diff(y(x),x) = -lambda*exp(lambda*x)*y(x)^2+a*exp(mu*x)*y(x)-a*exp((mu-lambda)*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {a c_1 \,{\mathrm e}^{\left (\mu -\lambda \right ) x} \operatorname {hypergeom}\left (\left [\frac {\mu -\lambda }{\mu }\right ], \left [\frac {-\lambda +2 \mu }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right )+\lambda -\mu }{\left (-\mu +\lambda \right ) \left (c_1 \operatorname {hypergeom}\left (\left [-\frac {\lambda }{\mu }\right ], \left [\frac {\mu -\lambda }{\mu }\right ], \frac {a \,{\mathrm e}^{\mu x}}{\mu }\right )+{\mathrm e}^{\lambda x}\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*exp(mu*x)+lambda) 
*diff(y(x),x)-lambda*exp(lambda*x)*a*exp(-lambda*x+mu*x)*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 
               <- Kummer successful 
            <- special function solution successful 
               Solution using Kummer functions still has integrals. Trying a hy\ 
pergeometric solution. 
               -> hyper3: Equivalence to 2F1, 1F1 or 0F1 under a power @ Moebi\ 
us 
               <- hyper3 successful: received ODE is equivalent to the 1F1 ODE 
               -> 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 = ln(t)/mu] 
         Linear ODE actually solved: 
            lambda*a*u(t)+(-a*mu*t-lambda*mu+mu^2)*diff(u(t),t)+mu^2*t*diff(dif\ 
f(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 )=-\lambda \,{\mathrm e}^{\lambda x} y \left (x \right )^{2}+a \,{\mathrm e}^{\mu x} y \left (x \right )-a \,{\mathrm e}^{\left (\mu -\lambda \right ) x} \\ \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 )=-\lambda \,{\mathrm e}^{\lambda x} y \left (x \right )^{2}+a \,{\mathrm e}^{\mu x} y \left (x \right )-a \,{\mathrm e}^{\left (\mu -\lambda \right ) x} \end {array} \]
2.3.14.3 Mathematica. Time used: 1.501 (sec). Leaf size: 165
ode=D[y[x],x]==-\[Lambda]*Exp[\[Lambda]*x]*y[x]^2+a*Exp[\[Mu]*x]*y[x]-a*Exp[(\[Mu]-\[Lambda])*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {e^{\lambda (-x)} \left (-\lambda \left (-\frac {a e^{\mu x}}{\mu }\right )^{\lambda /\mu } \Gamma \left (-\frac {\lambda }{\mu },-\frac {a e^{x \mu }}{\mu }\right )+\mu e^{\frac {a e^{\mu x}}{\mu }}+c_1 \lambda e^{\frac {\lambda }{\mu }+1} \left (e^{\mu x}\right )^{\lambda /\mu }\right )}{\lambda \left (-\left (-\frac {a e^{\mu x}}{\mu }\right )^{\lambda /\mu } \Gamma \left (-\frac {\lambda }{\mu },-\frac {a e^{x \mu }}{\mu }\right )+c_1 e^{\frac {\lambda }{\mu }+1} \left (e^{\mu x}\right )^{\lambda /\mu }\right )}\\ y(x)&\to e^{\lambda (-x)} \end{align*}
2.3.14.4 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
lambda_ = symbols("lambda_") 
mu = symbols("mu") 
y = Function("y") 
ode = Eq(-a*y(x)*exp(mu*x) + a*exp(x*(-lambda_ + mu)) + lambda_*y(x)**2*exp(lambda_*x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -a*y(x)*exp(mu*x) + a*exp(-lambda_*x + mu*x) + lambda_*y(x)**2*exp(lambda_*x) + Derivative(y(x), x) cannot be solved by the factorable group method