64.13.23 problem 23

Internal problem ID [13482]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 4, Section 4.5. The Cauchy-Euler Equation. Exercises page 169
Problem number : 23
Date solved : Monday, March 31, 2025 at 07:59:15 AM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

\begin{align*} x^{2} y^{\prime \prime }-2 y&=4 x -8 \end{align*}

With initial conditions

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

Maple. Time used: 0.025 (sec). Leaf size: 15
ode:=x^2*diff(diff(y(x),x),x)-2*y(x) = 4*x-8; 
ic:=y(1) = 4, D(y)(1) = -1; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = x^{2}+\frac {1}{x}+4-2 x \]
Mathematica. Time used: 0.019 (sec). Leaf size: 16
ode=x^2*D[y[x],{x,2}]-2*y[x]==4*x-8; 
ic={y[1]==4,Derivative[1][y][1]==-1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x^2-2 x+\frac {1}{x}+4 \]
Sympy. Time used: 0.195 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), (x, 2)) - 4*x - 2*y(x) + 8,0) 
ics = {y(1): 4, Subs(Derivative(y(x), x), x, 1): -1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x^{2} - 2 x + 4 + \frac {1}{x} \]