71.7.6 problem 6

Internal problem ID [14348]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 2. The Initial Value Problem. Exercises 2.3.3, page 71
Problem number : 6
Date solved : Wednesday, March 05, 2025 at 10:47:51 PM
CAS classification : [_linear]

\begin{align*} y^{\prime }&=\frac {2 y}{x}+{\mathrm e}^{x} \end{align*}

With initial conditions

\begin{align*} y \left (1\right )&={\frac {1}{2}} \end{align*}

Maple. Time used: 0.123 (sec). Leaf size: 36
ode:=diff(y(x),x) = 2*y(x)/x+exp(x); 
ic:=y(1) = 1/2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = -\operatorname {Ei}_{1}\left (-x \right ) x^{2}+\operatorname {Ei}_{1}\left (-1\right ) x^{2}+\frac {\left (2 x \,{\mathrm e}+x -2 \,{\mathrm e}^{x}\right ) x}{2} \]
Mathematica. Time used: 0.097 (sec). Leaf size: 32
ode=D[y[x],x]==2*y[x]/x+Exp[x]; 
ic={y[1]==1/2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{2} x^2 \left (2 \int _1^x\frac {e^{K[1]}}{K[1]^2}dK[1]+1\right ) \]
Sympy. Time used: 0.451 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-exp(x) + Derivative(y(x), x) - 2*y(x)/x,0) 
ics = {y(1): 1/2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x \left (x \left (\frac {1}{2} + \operatorname {E}_{2}\left (-1\right )\right ) - \operatorname {E}_{2}\left (- x\right )\right ) \]