23.1.45 problem 39

Internal problem ID [4652]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 1. THE DIFFERENTIAL EQUATION IS OF FIRST ORDER AND OF FIRST DEGREE, page 223
Problem number : 39
Date solved : Tuesday, September 30, 2025 at 07:38:10 AM
CAS classification : [_linear]

\begin{align*} y^{\prime }&=f \left (x \right )+g \left (x \right ) y \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 24
ode:=diff(y(x),x) = f(x)+g(x)*y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (\int f \left (x \right ) {\mathrm e}^{-\int g \left (x \right )d x}d x +c_1 \right ) {\mathrm e}^{\int g \left (x \right )d x} \]
Mathematica. Time used: 0.033 (sec). Leaf size: 47
ode=D[y[x],x]==f[x] + g[x] y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \exp \left (\int _1^xg(K[1])dK[1]\right ) \left (\int _1^x\exp \left (-\int _1^{K[2]}g(K[1])dK[1]\right ) f(K[2])dK[2]+c_1\right ) \end{align*}
Sympy. Time used: 1.342 (sec). Leaf size: 58
from sympy import * 
x = symbols("x") 
y = Function("y") 
f = Function("f") 
g = Function("g") 
ode = Eq(-f(x) - g(x)*y(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {\left (C_{1} + \int f{\left (x \right )} e^{- \int g{\left (x \right )}\, dx}\, dx + \int g{\left (x \right )} y{\left (x \right )} e^{- \int g{\left (x \right )}\, dx}\, dx\right ) e^{\int g{\left (x \right )}\, dx}}{\left (e^{\int g{\left (x \right )}\, dx}\right ) \int g{\left (x \right )} e^{- \int g{\left (x \right )}\, dx}\, dx + 1} \]