12.7.22 problem 23

Internal problem ID [1732]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. Exact equations. Integrating factors. Section 2.6 Page 91
Problem number : 23
Date solved : Saturday, March 29, 2025 at 11:37:53 PM
CAS classification : [_separable]

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

Maple. Time used: 0.045 (sec). Leaf size: 18
ode:=y(x)*(x*cos(x)+2*sin(x))+x*(y(x)+1)*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \operatorname {LambertW}\left ({\mathrm e}^{-\sin \left (x \right )-2 \,\operatorname {Si}\left (x \right )-c_1}\right ) \]
Mathematica. Time used: 2.359 (sec). Leaf size: 24
ode=(y[x]*(x*Cos[x]+2*Sin[x]))+(x*(y[x]+1))*D[y[x],x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to W\left (e^{-2 \text {Si}(x)-\sin (x)+c_1}\right ) \\ y(x)\to 0 \\ \end{align*}
Sympy. Time used: 0.757 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*(y(x) + 1)*Derivative(y(x), x) + (x*cos(x) + 2*sin(x))*y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = W\left (C_{1} e^{- \sin {\left (x \right )} - 2 \operatorname {Si}{\left (x \right )}}\right ) \]