15.7.11 problem 11

Internal problem ID [2992]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 11, page 45
Problem number : 11
Date solved : Tuesday, March 04, 2025 at 03:38:37 PM
CAS classification : [_Bernoulli]

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

Maple. Time used: 0.003 (sec). Leaf size: 16
ode:=x*diff(y(x),x)+y(x) = y(x)^2*x^2*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {1}{\left (-\sin \left (x \right )+c_{1} \right ) x} \]
Mathematica. Time used: 0.208 (sec). Leaf size: 22
ode=x*D[y[x],x]+y[x]==y[x]^2*x^2*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {1}{-x \sin (x)+c_1 x} \\ y(x)\to 0 \\ \end{align*}
Sympy. Time used: 0.248 (sec). Leaf size: 10
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*y(x)**2*cos(x) + x*Derivative(y(x), x) + y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {1}{x \left (C_{1} - \sin {\left (x \right )}\right )} \]