25.1.28 problem 28

Internal problem ID [4240]
Book : Advanced Mathematica, Book2, Perkin and Perkin, 1992
Section : Chapter 11.3, page 316
Problem number : 28
Date solved : Tuesday, March 04, 2025 at 05:57:32 PM
CAS classification : [[_homogeneous, `class A`], _rational, _Bernoulli]

\begin{align*} x y y^{\prime }&=2 x^{2}-y^{2} \end{align*}

Maple. Time used: 0.005 (sec). Leaf size: 30
ode:=x*y(x)*diff(y(x),x) = 2*x^2-y(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y \left (x \right ) &= \frac {\sqrt {x^{4}+c_{1}}}{x} \\ y \left (x \right ) &= -\frac {\sqrt {x^{4}+c_{1}}}{x} \\ \end{align*}
Mathematica. Time used: 0.204 (sec). Leaf size: 38
ode=x*y[x]*D[y[x],x]==2*x^2-y[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -\frac {\sqrt {x^4+c_1}}{x} \\ y(x)\to \frac {\sqrt {x^4+c_1}}{x} \\ \end{align*}
Sympy. Time used: 0.354 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x**2 + x*y(x)*Derivative(y(x), x) + y(x)**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = - \frac {\sqrt {C_{1} + x^{4}}}{x}, \ y{\left (x \right )} = \frac {\sqrt {C_{1} + x^{4}}}{x}\right ] \]