71.9.16 problem 18

Internal problem ID [14416]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 4. N-th Order Linear Differential Equations. Exercises 4.1, page 186
Problem number : 18
Date solved : Saturday, February 22, 2025 at 03:47:38 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

With initial conditions

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

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