61.19.29 problem 29

Internal problem ID [12219]
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 : 29
Date solved : Wednesday, March 05, 2025 at 05:53:10 PM
CAS classification : [_Riccati]

\begin{align*} y^{\prime }&=\lambda \sin \left (\lambda x \right ) y^{2}+f \left (x \right ) \cos \left (\lambda x \right ) y-f \left (x \right ) \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 97
ode:=diff(y(x),x) = lambda*sin(lambda*x)*y(x)^2+f(x)*cos(lambda*x)*y(x)-f(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-c_{1} {\mathrm e}^{\int \left (f \cos \left (\lambda x \right )+2 \tan \left (\lambda x \right ) \lambda \right )d x}+\sec \left (\lambda x \right ) \lambda \left (\int {\mathrm e}^{\int \left (f \cos \left (\lambda x \right )+2 \tan \left (\lambda x \right ) \lambda \right )d x} \sin \left (\lambda x \right )d x \right ) c_{1} -\sec \left (\lambda x \right )}{\lambda \left (\int {\mathrm e}^{\int \left (f \cos \left (\lambda x \right )+2 \tan \left (\lambda x \right ) \lambda \right )d x} \sin \left (\lambda x \right )d x \right ) c_{1} -1} \]
Mathematica
ode=D[y[x],x]==\[Lambda]*Sin[\[Lambda]*x]*y[x]^2+f[x]*Cos[\[Lambda]*x]*y[x]-f[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 

Not solved

Sympy
from sympy import * 
x = symbols("x") 
cg = symbols("cg") 
y = Function("y") 
f = Function("f") 
ode = Eq(-cg*y(x)**2*sin(cg*x) - f(x)*y(x)*cos(cg*x) + f(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -cg*y(x)**2*sin(cg*x) - f(x)*y(x)*cos(cg*x) + f(x) + Derivative(y(x), x) cannot be solved by the lie group method