81.4.9 problem 5-10

Internal problem ID [21523]
Book : The Differential Equations Problem Solver. VOL. I. M. Fogiel director. REA, NY. 1978. ISBN 78-63609
Section : Chapter 5. Integrating factors. Page 72.
Problem number : 5-10
Date solved : Thursday, October 02, 2025 at 07:46:46 PM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (0\right )&=y_{0} \\ \end{align*}
Maple. Time used: 0.015 (sec). Leaf size: 39
ode:=diff(y(x),x)+(b*x+a)*y(x) = f(x); 
ic:=[y(0) = y__0]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \left (\int _{0}^{x}f \left (\textit {\_z1} \right ) {\mathrm e}^{\frac {1}{2} \textit {\_z1}^{2} b +\textit {\_z1} a}d \textit {\_z1} +y_{0} \right ) {\mathrm e}^{-\frac {1}{2} b \,x^{2}-a x} \]
Mathematica. Time used: 0.005 (sec). Leaf size: 26
ode=D[y[x],x]+(a+b*x)==f[x]; 
ic={y[0]==y0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \int _0^x(-a+f(K[1])-b K[1])dK[1]+\text {y0} \end{align*}
Sympy. Time used: 0.140 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
y0 = symbols("y0") 
y = Function("y") 
f = Function("f") 
ode = Eq(a + b*x - f(x) + Derivative(y(x), x),0) 
ics = {y(0): y0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = y_{0} - \int \limits ^{0} \left (- a\right )\, dx - \int \limits ^{0} \left (- b x\right )\, dx + \int \left (- a - b x + f{\left (x \right )}\right )\, dx - \int \limits ^{0} f{\left (x \right )}\, dx \]