2.4.12 Problem 33

2.4.12.1 Solved using first_order_ode_riccati
2.4.12.2 Maple
2.4.12.3 Mathematica
2.4.12.4 Sympy

Internal problem ID [13312]
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-2. Equations with power and exponential functions
Problem number : 33
Date solved : Wednesday, December 31, 2025 at 01:12:46 PM
CAS classification : [_Riccati]

2.4.12.1 Solved using first_order_ode_riccati

13.372 (sec)

Entering first order ode riccati solver

\begin{align*} y^{\prime }&=a \,x^{n} {\mathrm e}^{2 \lambda x} y^{2}+\left ({\mathrm e}^{\lambda x} x^{n} b -\lambda \right ) y+c \,x^{n} \\ \end{align*}
In canonical form the ODE is
\begin{align*} y' &= F(x,y)\\ &= a \,x^{n} {\mathrm e}^{2 \lambda x} y^{2}+x^{n} {\mathrm e}^{\lambda x} b y+c \,x^{n}-\lambda y \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)=c \,x^{n}\), \(f_1(x)={\mathrm e}^{\lambda x} x^{n} b -\lambda \) and \(f_2(x)=x^{n} {\mathrm e}^{2 \lambda x} a\). Let
\begin{align*} y &= \frac {-u'}{f_2 u} \\ &= \frac {-u'}{u \,x^{n} a \,{\mathrm e}^{2 \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' &=\frac {x^{n} n a \,{\mathrm e}^{2 \lambda x}}{x}+2 x^{n} {\mathrm e}^{2 \lambda x} a \lambda \\ f_1 f_2 &=\left ({\mathrm e}^{\lambda x} x^{n} b -\lambda \right ) x^{n} a \,{\mathrm e}^{2 \lambda x}\\ f_2^2 f_0 &=x^{3 n} a^{2} {\mathrm e}^{4 \lambda x} c \end{align*}

Substituting the above terms back in equation (2) gives

\[ x^{n} a \,{\mathrm e}^{2 \lambda x} u^{\prime \prime }\left (x \right )-\left (\frac {x^{n} n a \,{\mathrm e}^{2 \lambda x}}{x}+2 x^{n} {\mathrm e}^{2 \lambda x} a \lambda +\left ({\mathrm e}^{\lambda x} x^{n} b -\lambda \right ) x^{n} a \,{\mathrm e}^{2 \lambda x}\right ) u^{\prime }\left (x \right )+x^{3 n} a^{2} {\mathrm e}^{4 \lambda x} c 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 ) = {\mathrm e}^{\int \frac {\left (b^{2}+\tan \left (\frac {\sqrt {4 a \,b^{2} c -b^{4}}\, \left (-\left (-\lambda x \right )^{-n} \Gamma \left (n , -\lambda x \right ) n \,x^{n} b +\Gamma \left (n \right ) n \,x^{n} b \left (-\lambda x \right )^{-n}-{\mathrm e}^{\lambda x} x^{n} b -c_1 \lambda \right )}{2 b^{2} \lambda }\right ) \sqrt {4 a \,b^{2} c -b^{4}}\right ) x^{n} {\mathrm e}^{\lambda x}}{2 b}d x} c_2 \end{equation}
Taking derivative gives
\begin{equation} \tag{4} u^{\prime }\left (x \right ) = \frac {\left (b^{2}+\tan \left (\frac {\sqrt {4 a \,b^{2} c -b^{4}}\, \left (-\left (-\lambda x \right )^{-n} \Gamma \left (n , -\lambda x \right ) n \,x^{n} b +\Gamma \left (n \right ) n \,x^{n} b \left (-\lambda x \right )^{-n}-{\mathrm e}^{\lambda x} x^{n} b -c_1 \lambda \right )}{2 b^{2} \lambda }\right ) \sqrt {4 a \,b^{2} c -b^{4}}\right ) x^{n} {\mathrm e}^{\lambda x} {\mathrm e}^{\int \frac {\left (b^{2}+\tan \left (\frac {\sqrt {4 a \,b^{2} c -b^{4}}\, \left (-\left (-\lambda x \right )^{-n} \Gamma \left (n , -\lambda x \right ) n \,x^{n} b +\Gamma \left (n \right ) n \,x^{n} b \left (-\lambda x \right )^{-n}-{\mathrm e}^{\lambda x} x^{n} b -c_1 \lambda \right )}{2 b^{2} \lambda }\right ) \sqrt {4 a \,b^{2} c -b^{4}}\right ) x^{n} {\mathrm e}^{\lambda x}}{2 b}d x} c_2}{2 b} \end{equation}
Substituting equations (3,4) into (1) results in
\begin{align*} y &= \frac {-u'}{f_2 u} \\ y &= \frac {-u'}{u \,x^{n} a \,{\mathrm e}^{2 \lambda x}} \\ y &= -\frac {\left (b^{2}+\tan \left (\frac {\sqrt {4 a \,b^{2} c -b^{4}}\, \left (-\left (-\lambda x \right )^{-n} \Gamma \left (n , -\lambda x \right ) n \,x^{n} b +\Gamma \left (n \right ) n \,x^{n} b \left (-\lambda x \right )^{-n}-{\mathrm e}^{\lambda x} x^{n} b -c_1 \lambda \right )}{2 b^{2} \lambda }\right ) \sqrt {4 a \,b^{2} c -b^{4}}\right ) {\mathrm e}^{-\lambda x}}{2 b a} \\ \end{align*}

Summary of solutions found

\begin{align*} y &= \frac {{\mathrm e}^{-\lambda x} \left (\tan \left (\frac {\sqrt {4 a \,b^{2} c -b^{4}}\, \left (\left (-\lambda x \right )^{-n} \Gamma \left (n , -\lambda x \right ) n \,x^{n} b -\left (-\lambda x \right )^{-n} x^{n} \Gamma \left (n +1\right ) b +{\mathrm e}^{\lambda x} x^{n} b +c_1 \lambda \right )}{2 b^{2} \lambda }\right ) \sqrt {4 a \,b^{2} c -b^{4}}-b^{2}\right )}{2 a b} \\ \end{align*}
2.4.12.2 Maple. Time used: 0.005 (sec). Leaf size: 114
ode:=diff(y(x),x) = a*x^n*exp(2*lambda*x)*y(x)^2+(b*x^n*exp(lambda*x)-lambda)*y(x)+c*x^n; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (\tan \left (\frac {\sqrt {4 b^{2} a c -b^{4}}\, \left (\Gamma \left (n , -\lambda x \right ) x^{n} n \left (-\lambda x \right )^{-n} b -x^{n} \left (-\lambda x \right )^{-n} \Gamma \left (n +1\right ) b +b \,x^{n} {\mathrm e}^{\lambda x}+c_1 \lambda \right )}{2 b^{2} \lambda }\right ) \sqrt {4 b^{2} a c -b^{4}}-b^{2}\right ) {\mathrm e}^{-\lambda x}}{2 a b} \]

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 
<- Chini successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=a \,x^{13312} {\mathrm e}^{2 \lambda x} y \left (x \right )^{2}+\left (b \,x^{13312} {\mathrm e}^{\lambda x}-\lambda \right ) y \left (x \right )+c \,x^{13312} \\ \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 )=a \,x^{13312} {\mathrm e}^{2 \lambda x} y \left (x \right )^{2}+\left (b \,x^{13312} {\mathrm e}^{\lambda x}-\lambda \right ) y \left (x \right )+c \,x^{13312} \end {array} \]
2.4.12.3 Mathematica. Time used: 0.95 (sec). Leaf size: 102
ode=D[y[x],x]==a*x^n*Exp[2*\[Lambda]*x]*y[x]^2+(b*x^n*Exp[\[Lambda]*x]-\[Lambda])*y[x]+c*x^n; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [\int _1^{\sqrt {\frac {a e^{2 x \lambda }}{c}} y(x)}\frac {1}{K[1]^2-\sqrt {\frac {b^2}{a c}} K[1]+1}dK[1]=\frac {c x^n e^{\lambda (-x)} (\lambda (-x))^{-n} \sqrt {\frac {a e^{2 \lambda x}}{c}} \Gamma (n+1,-x \lambda )}{\lambda }+c_1,y(x)\right ] \]
2.4.12.4 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
c = symbols("c") 
lambda_ = symbols("lambda_") 
n = symbols("n") 
y = Function("y") 
ode = Eq(-a*x**n*y(x)**2*exp(2*lambda_*x) - c*x**n - (b*x**n*exp(lambda_*x) - lambda_)*y(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -a*x**n*y(x)**2*exp(2*lambda_*x) - b*x**n*y(x)*exp(lambda_*x) - c*x**n + lambda_*y(x) + Derivative(y(x), x) cannot be solved by the factorable group method