4.2.30 problem 31

Internal problem ID [1158]
Book : Elementary differential equations and boundary value problems, 10th ed., Boyce and DiPrima
Section : Section 2.2. Page 48
Problem number : 31
Date solved : Tuesday, September 30, 2025 at 04:24:54 AM
CAS classification : [[_homogeneous, `class A`], _rational, _Riccati]

\begin{align*} y^{\prime }&=\frac {x^{2}+x y+y^{2}}{x^{2}} \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 11
ode:=diff(y(x),x) = (x^2+x*y(x)+y(x)^2)/x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \tan \left (\ln \left (x \right )+c_1 \right ) x \]
Mathematica. Time used: 0.134 (sec). Leaf size: 13
ode=D[y[x],x] == (x^2+x*y[x]+y[x]^2)/x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x \tan (\log (x)+c_1) \end{align*}
Sympy. Time used: 0.173 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) - (x**2 + x*y(x) + y(x)**2)/x**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x \left (i C_{1} + i e^{2 i \log {\left (x \right )}}\right )}{C_{1} - e^{2 i \log {\left (x \right )}}} \]