28.2.54 problem 54

Internal problem ID [4497]
Book : Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
Section : Chapter 4. Linear Differential Equations. Page 183
Problem number : 54
Date solved : Tuesday, March 04, 2025 at 06:49:05 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.006 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)-y(x) = 1/x-2/x^3; 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \frac {c_{2} {\mathrm e}^{x} x +c_{1} x \,{\mathrm e}^{-x}-1}{x} \]
Mathematica. Time used: 0.232 (sec). Leaf size: 25
ode=D[y[x],{x,2}]-y[x]==1/x-2/x^3; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {1}{x}+c_1 e^x+c_2 e^{-x} \]
Sympy. Time used: 0.251 (sec). Leaf size: 15
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x) + Derivative(y(x), (x, 2)) - 1/x + 2/x**3,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- x} + C_{2} e^{x} - \frac {1}{x} \]