29.4.7 problem 95

Internal problem ID [4698]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 4
Problem number : 95
Date solved : Sunday, March 30, 2025 at 03:39:51 AM
CAS classification : [_Bernoulli]

\begin{align*} y^{\prime }&=f \left (x \right ) y+g \left (x \right ) y^{k} \end{align*}

Maple. Time used: 0.035 (sec). Leaf size: 51
ode:=diff(y(x),x) = f(x)*y(x)+g(x)*y(x)^k; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\int f \left (x \right )d x} \left (-k \int g \left (x \right ) {\mathrm e}^{\left (k -1\right ) \int f \left (x \right )d x}d x +c_1 +\int g \left (x \right ) {\mathrm e}^{\left (k -1\right ) \int f \left (x \right )d x}d x \right )^{-\frac {1}{k -1}} \]
Mathematica. Time used: 11.65 (sec). Leaf size: 67
ode=D[y[x],x]==f[x] y[x]+g[x]y[x]^k; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \left (\exp \left (-\left ((k-1) \int _1^xf(K[1])dK[1]\right )\right ) \left (-(k-1) \int _1^x\exp \left ((k-1) \int _1^{K[2]}f(K[1])dK[1]\right ) g(K[2])dK[2]+c_1\right )\right ){}^{\frac {1}{1-k}} \]
Sympy. Time used: 3.864 (sec). Leaf size: 53
from sympy import * 
x = symbols("x") 
k = symbols("k") 
y = Function("y") 
f = Function("f") 
g = Function("g") 
ode = Eq(-f(x)*y(x) - g(x)*y(x)**k + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (\left (C_{1} - k \int g{\left (x \right )} e^{\left (k - 1\right ) \int f{\left (x \right )}\, dx}\, dx + \int g{\left (x \right )} e^{\left (k - 1\right ) \int f{\left (x \right )}\, dx}\, dx\right ) e^{- \left (k - 1\right ) \int f{\left (x \right )}\, dx}\right )^{- \frac {1}{k - 1}} \]