10.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 : Saturday, March 29, 2025 at 10:48:08 PM
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,ic],y(x), singsol=all);
 
\[ y = \frac {-{\mathrm e}^{1-x}+1}{x} \]
Mathematica. Time used: 0.035 (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]
 
\[ y(x)\to \frac {1-e^{1-x}}{x} \]
Sympy. Time used: 0.269 (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} \]