44.22.1 problem 1(a)

Internal problem ID [9430]
Book : Differential Equations: Theory, Technique, and Practice by George Simmons, Steven Krantz. McGraw-Hill NY. 2007. 1st Edition.
Section : Chapter 4. Power Series Solutions and Special Functions. Problems for review and discovert. (A) Drill Exercises . Page 194
Problem number : 1(a)
Date solved : Tuesday, September 30, 2025 at 06:18:43 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

Using series method with expansion around

\begin{align*} 0 \end{align*}
Maple. Time used: 0.006 (sec). Leaf size: 49
Order:=8; 
ode:=diff(diff(y(x),x),x)+2*x*y(x) = x^2; 
dsolve(ode,y(x),type='series',x=0);
 
\[ y = \left (1-\frac {1}{3} x^{3}+\frac {1}{45} x^{6}\right ) y \left (0\right )+\left (x -\frac {1}{6} x^{4}+\frac {1}{126} x^{7}\right ) y^{\prime }\left (0\right )+\frac {x^{4}}{12}-\frac {x^{7}}{252}+O\left (x^{8}\right ) \]
Mathematica. Time used: 0.003 (sec). Leaf size: 56
ode=D[y[x],{x,2}]+2*x*y[x]==x^2; 
ic={}; 
AsymptoticDSolveValue[{ode,ic},y[x],{x,0,7}]
 
\[ y(x)\to -\frac {x^7}{252}+\frac {x^4}{12}+c_2 \left (\frac {x^7}{126}-\frac {x^4}{6}+x\right )+c_1 \left (\frac {x^6}{45}-\frac {x^3}{3}+1\right ) \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + 2*x*y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics,hint="2nd_power_series_regular",x0=0,n=8)
 
ValueError : ODE -x**2 + 2*x*y(x) + Derivative(y(x), (x, 2)) does not match hint 2nd_power_series_regular