57.1.23 problem 23

Internal problem ID [9007]
Book : First order enumerated odes
Section : section 1
Problem number : 23
Date solved : Wednesday, March 05, 2025 at 07:14:25 AM
CAS classification : [_rational, _Bernoulli]

\begin{align*} c y^{\prime }&=\frac {a x +b y^{2}}{y} \end{align*}

Maple. Time used: 0.013 (sec). Leaf size: 69
ode:=c*diff(y(x),x) = (a*x+b*y(x)^2)/y(x); 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y &= -\frac {\sqrt {4 \,{\mathrm e}^{\frac {2 b x}{c}} c_{1} b^{2}-4 a x b -2 a c}}{2 b} \\ y &= \frac {\sqrt {4 \,{\mathrm e}^{\frac {2 b x}{c}} c_{1} b^{2}-4 a x b -2 a c}}{2 b} \\ \end{align*}
Mathematica. Time used: 6.918 (sec). Leaf size: 85
ode=c*D[y[x],x]==(a*x+b*y[x]^2)/y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -\frac {i \sqrt {a b x+\frac {a c}{2}+b^2 c_1 \left (-e^{\frac {2 b x}{c}}\right )}}{b} \\ y(x)\to \frac {i \sqrt {a b x+\frac {a c}{2}+b^2 c_1 \left (-e^{\frac {2 b x}{c}}\right )}}{b} \\ \end{align*}
Sympy. Time used: 1.733 (sec). Leaf size: 139
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
c = symbols("c") 
y = Function("y") 
ode = Eq(c*Derivative(y(x), x) - (a*x + b*y(x)**2)/y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \begin {cases} - \frac {\sqrt {2} \sqrt {2 C_{1} e^{\frac {2 b x}{c}} - \frac {2 a x}{b} - \frac {a c}{b^{2}}}}{2} & \text {for}\: b > 0 \vee b < 0 \\- \sqrt {C_{1} e^{\frac {2 b x}{c}} + \frac {a x^{2} e^{\frac {2 b x}{c}}}{c}} & \text {otherwise} \end {cases}, \ y{\left (x \right )} = \begin {cases} \frac {\sqrt {2} \sqrt {2 C_{1} e^{\frac {2 b x}{c}} - \frac {2 a x}{b} - \frac {a c}{b^{2}}}}{2} & \text {for}\: b > 0 \vee b < 0 \\\sqrt {C_{1} e^{\frac {2 b x}{c}} + \frac {a x^{2} e^{\frac {2 b x}{c}}}{c}} & \text {otherwise} \end {cases}\right ] \]