6.2.29 problem 29

Internal problem ID [1565]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. Linear first order. Section 2.1 Page 41
Problem number : 29
Date solved : Tuesday, September 30, 2025 at 04:36:33 AM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (-1\right )&=0 \\ \end{align*}
Maple. Time used: 0.032 (sec). Leaf size: 21
ode:=diff(y(x),x)+y(x)/x = 2/x^2+1; 
ic:=[y(-1) = 0]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \frac {-4 i \pi +x^{2}+4 \ln \left (x \right )-1}{2 x} \]
Mathematica. Time used: 0.019 (sec). Leaf size: 26
ode=D[y[x],x]+y[x]/x==2/x^2+1; 
ic=y[-1]==0; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {x^2+4 \log (x)-4 i \pi -1}{2 x} \end{align*}
Sympy. Time used: 0.148 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) - 1 + y(x)/x - 2/x**2,0) 
ics = {y(-1): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {\frac {x^{2}}{2} + 2 \log {\left (x \right )} - \frac {1}{2} - 2 i \pi }{x} \]