62.6.2 problem Ex 2

Internal problem ID [12741]
Book : An elementary treatise on differential equations by Abraham Cohen. DC heath publishers. 1906
Section : Chapter 2, differential equations of the first order and the first degree. Article 13. Linear equations of first order. Page 19
Problem number : Ex 2
Date solved : Wednesday, March 05, 2025 at 08:23:36 PM
CAS classification : [_linear]

\begin{align*} x y^{\prime }+\left (1+x \right ) y&={\mathrm e}^{x} \end{align*}

Maple. Time used: 0.001 (sec). Leaf size: 19
ode:=x*diff(y(x),x)+(1+x)*y(x) = exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{x}+2 c_{1} {\mathrm e}^{-x}}{2 x} \]
Mathematica. Time used: 0.064 (sec). Leaf size: 27
ode=x*D[y[x],x]+(1+x)*y[x]==Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {e^x+2 c_1 e^{-x-1}}{2 x} \]
Sympy. Time used: 0.309 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) + (x + 1)*y(x) - exp(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} e^{- x} + \frac {e^{x}}{2}}{x} \]