71.4.18 problem 18

Internal problem ID [14311]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 2. The Initial Value Problem. Exercises 2.2, page 53
Problem number : 18
Date solved : Wednesday, March 05, 2025 at 10:45:16 PM
CAS classification : [_linear]

\begin{align*} y^{\prime }&=\frac {y}{x}+\cos \left (x \right ) \end{align*}

With initial conditions

\begin{align*} y \left (-1\right )&=0 \end{align*}

Maple. Time used: 0.065 (sec). Leaf size: 16
ode:=diff(y(x),x) = y(x)/x+cos(x); 
ic:=y(-1) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \left (\operatorname {Ci}\left (x \right )-\operatorname {Ci}\left (1\right )-i \pi \right ) x \]
Mathematica. Time used: 0.033 (sec). Leaf size: 14
ode=D[y[x],x]==y[x]/x+Cos[x]; 
ic={y[-1]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x (\operatorname {CosIntegral}(x)-\operatorname {CosIntegral}(-1)) \]
Sympy. Time used: 0.600 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-cos(x) + Derivative(y(x), x) - y(x)/x,0) 
ics = {y(-1): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x \left (\operatorname {Ci}{\left (x \right )} - \operatorname {Ci}{\left (-1 \right )}\right ) \]