4.6.6 problem 6

Internal problem ID [1223]
Book : Elementary differential equations and boundary value problems, 10th ed., Boyce and DiPrima
Section : Miscellaneous problems, end of chapter 2. Page 133
Problem number : 6
Date solved : Tuesday, September 30, 2025 at 04:30:03 AM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (1\right )&=0 \\ \end{align*}
Maple. Time used: 0.031 (sec). Leaf size: 18
ode:=x*y(x)+x*diff(y(x),x) = 1-y(x); 
ic:=[y(1) = 0]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \frac {-{\mathrm e}^{1-x}+1}{x} \]
Mathematica. Time used: 0.019 (sec). Leaf size: 20
ode=x*y[x]+x*D[y[x],x] == 1-y[x]; 
ic=y[1]==0; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1-e^{1-x}}{x} \end{align*}
Sympy. Time used: 0.169 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*y(x) + x*Derivative(y(x), x) + y(x) - 1,0) 
ics = {y(1): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {1 - e e^{- x}}{x} \]