23.2.23 problem 8

Internal problem ID [4140]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 3. Linear differential equations of second order. Exercises at page 31
Problem number : 8
Date solved : Tuesday, March 04, 2025 at 05:53:26 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

Maple. Time used: 0.009 (sec). Leaf size: 22
ode:=x^2*diff(diff(y(x),x),x)-2*x*diff(y(x),x)+2*y(x) = x^2+2; 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \ln \left (x \right ) x^{2}+1+x^{2} \left (c_{1} -1\right )+c_{2} x \]
Mathematica. Time used: 0.021 (sec). Leaf size: 25
ode=x^2*D[y[x],{x,2}]-2*x*D[y[x],x]+2*y[x]==x^2+2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x^2 \log (x)+(-1+c_2) x^2+c_1 x+1 \]
Sympy. Time used: 0.238 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), (x, 2)) - x**2 - 2*x*Derivative(y(x), x) + 2*y(x) - 2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} x + C_{2} x^{2} + x^{2} \log {\left (x \right )} + 1 \]