2.19.17 Problem 17

2.19.17.1 Solved using first_order_ode_riccati
2.19.17.2 Solved using first_order_ode_riccati_by_guessing_particular_solution
2.19.17.3 Maple
2.19.17.4 Mathematica
2.19.17.5 Sympy

Internal problem ID [13465]
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.8-1. Equations containing arbitrary functions (but not containing their derivatives).
Problem number : 17
Date solved : Sunday, January 18, 2026 at 08:22:33 PM
CAS classification : [_Riccati]

2.19.17.1 Solved using first_order_ode_riccati

1.901 (sec)

Entering first order ode riccati solver

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

This is a Riccati ODE. Comparing the ODE to solve

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

Substituting the above terms back in equation (2) gives

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

Summary of solutions found

\begin{align*} y &= -\frac {\left (\frac {a f \left (x \right ) {\mathrm e}^{\frac {a \int f \left (x \right )d x}{2}} \cosh \left (\frac {\sqrt {a^{4}-4 a^{2} b}\, \left (a \int f \left (x \right )d x +1\right )}{2 a^{2}}\right ) c_3}{2}+\frac {{\mathrm e}^{\frac {a \int f \left (x \right )d x}{2}} \sqrt {a^{4}-4 a^{2} b}\, f \left (x \right ) \sinh \left (\frac {\sqrt {a^{4}-4 a^{2} b}\, \left (a \int f \left (x \right )d x +1\right )}{2 a^{2}}\right ) c_3}{2 a}\right ) {\mathrm e}^{-\lambda x} {\mathrm e}^{\int -\frac {a f \left (x \right )}{2}d x}}{f \left (x \right ) \cosh \left (\frac {\sqrt {a^{4}-4 a^{2} b}\, \left (a \int f \left (x \right )d x +1\right )}{2 a^{2}}\right ) c_3} \\ \end{align*}
2.19.17.2 Solved using first_order_ode_riccati_by_guessing_particular_solution

0.444 (sec)

Entering first order ode riccati guess solver

\begin{align*} y^{\prime }&={\mathrm e}^{\lambda x} f \left (x \right ) y^{2}+\left (a f \left (x \right )-\lambda \right ) y+b \,{\mathrm e}^{-\lambda x} f \left (x \right ) \\ \end{align*}
This is a Riccati ODE. Comparing the above ODE to solve with the Riccati standard form
\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]
Shows that
\begin{align*} f_0(x) & =b \,{\mathrm e}^{-\lambda x} f \left (x \right )\\ f_1(x) & =a f \left (x \right )-\lambda \\ f_2(x) &=f \left (x \right ) {\mathrm e}^{\lambda x} \end{align*}

Using trial and error, the following particular solution was found

\[ y_p = \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) {\mathrm e}^{-\lambda x} \]
Since a particular solution is known, then the general solution is given by
\begin{align*} y &= y_p + \frac { \phi (x) }{ c_1 - \int { \phi (x) f_2 \,dx} } \end{align*}

Where

\begin{align*} \phi (x) &= e^{ \int 2 f_2 y_p + f_1 \,dx } \end{align*}

Evaluating the above gives the general solution as

\[ y = \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) {\mathrm e}^{-\lambda x}+\frac {{\mathrm e}^{\int \left (2 \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) {\mathrm e}^{-\lambda x} f \left (x \right ) {\mathrm e}^{\lambda x}+a f \left (x \right )-\lambda \right )d x}}{c_1 -\frac {{\mathrm e}^{\int \left (f \left (x \right ) \sqrt {a^{2}-4 b}-\lambda \right )d x +\lambda x}}{\sqrt {a^{2}-4 b}}} \]

Summary of solutions found

\begin{align*} y &= \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) {\mathrm e}^{-\lambda x}+\frac {{\mathrm e}^{\int \left (2 \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) {\mathrm e}^{-\lambda x} f \left (x \right ) {\mathrm e}^{\lambda x}+a f \left (x \right )-\lambda \right )d x}}{c_1 -\frac {{\mathrm e}^{\int \left (f \left (x \right ) \sqrt {a^{2}-4 b}-\lambda \right )d x +\lambda x}}{\sqrt {a^{2}-4 b}}} \\ \end{align*}
2.19.17.3 Maple. Time used: 0.018 (sec). Leaf size: 59
ode:=diff(y(x),x) = exp(lambda*x)*f(x)*y(x)^2+(a*f(x)-lambda)*y(x)+b*exp(-lambda*x)*f(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {{\mathrm e}^{-\lambda x} \left (a^{2}+\tanh \left (\frac {\sqrt {a^{2} \left (a^{2}-4 b \right )}\, \left (a \int f \left (x \right )d x +c_1 \right )}{2 a^{2}}\right ) \sqrt {a^{2} \left (a^{2}-4 b \right )}\right )}{2 a} \]

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 )={\mathrm e}^{\lambda x} f \left (x \right ) y \left (x \right )^{2}+\left (a f \left (x \right )-\lambda \right ) y \left (x \right )+b \,{\mathrm e}^{-\lambda x} f \left (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 )={\mathrm e}^{\lambda x} f \left (x \right ) y \left (x \right )^{2}+\left (a f \left (x \right )-\lambda \right ) y \left (x \right )+b \,{\mathrm e}^{-\lambda x} f \left (x \right ) \end {array} \]
2.19.17.4 Mathematica. Time used: 0.61 (sec). Leaf size: 87
ode=D[y[x],x]==Exp[\[Lambda]*x]*f[x]*y[x]^2+(a*f[x]-\[Lambda])*y[x]+b*Exp[-\[Lambda]*x]*f[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [\int _1^{\sqrt {\frac {e^{2 x \lambda }}{b}} y(x)}\frac {1}{K[1]^2-\sqrt {\frac {a^2}{b}} K[1]+1}dK[1]=\int _1^xb e^{-\lambda K[2]} \sqrt {\frac {e^{2 \lambda K[2]}}{b}} f(K[2])dK[2]+c_1,y(x)\right ] \]
2.19.17.5 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
lambda_ = symbols("lambda_") 
y = Function("y") 
f = Function("f") 
ode = Eq(-b*f(x)*exp(-lambda_*x) - (a*f(x) - lambda_)*y(x) - f(x)*y(x)**2*exp(lambda_*x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -(b*f(x) + (a*f(x) - lambda_ + f(x)*y(x)*exp(lambda_*x))*y(x)*ex
 
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')