2.2.4 Problem 4

2.2.4.1 Maple
2.2.4.2 Mathematica
2.2.4.3 Sympy

Internal problem ID [10415]
Book : Second order enumerated odes
Section : section 2
Problem number : 4
Date solved : Sunday, January 04, 2026 at 07:59:28 AM
CAS classification : [_Liouville, [_2nd_order, _reducible, _mu_x_y1], [_2nd_order, _reducible, _mu_xy]]

\begin{align*} y^{\prime \prime }+\left (\sin \left (x \right )+2 x \right ) y^{\prime }+\cos \left (y\right ) y {y^{\prime }}^{2}&=0 \\ \end{align*}
2.2.4.1 Maple. Time used: 0.003 (sec). Leaf size: 34
ode:=diff(diff(y(x),x),x)+(sin(x)+2*x)*diff(y(x),x)+cos(y(x))*y(x)*diff(y(x),x)^2 = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ \int _{}^{y}{\mathrm e}^{\cos \left (\textit {\_a} \right )+\sin \left (\textit {\_a} \right ) \textit {\_a}}d \textit {\_a} -c_1 \int {\mathrm e}^{-x^{2}+\cos \left (x \right )}d x -c_2 = 0 \]

Maple trace

Methods for second order ODEs: 
--- Trying classification methods --- 
trying 2nd order Liouville 
<- 2nd_order Liouville successful
 
2.2.4.2 Mathematica. Time used: 1.81 (sec). Leaf size: 68
ode=D[y[x],{x,2}]+(Sin[x]+2*x)*D[y[x],x]+Cos[y[x]]*y[x]*(D[y[x],x])^2==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \text {InverseFunction}\left [\int _1^{\text {$\#$1}}\exp \left (-\int _1^{K[3]}-\cos (K[1]) K[1]dK[1]\right )dK[3]\&\right ]\left [\int _1^x-\exp \left (-\int _1^{K[4]}(2 K[2]+\sin (K[2]))dK[2]\right ) c_1dK[4]+c_2\right ] \end{align*}
2.2.4.3 Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((2*x + sin(x))*Derivative(y(x), x) + y(x)*cos(y(x))*Derivative(y(x), x)**2 + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
Timed Out
 
Python version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] 
Sympy version 1.14.0