28.3.5 problem 5

Internal problem ID [7179]
Book : A treatise on ordinary and partial differential equations by William Woolsey Johnson. 1913
Section : Chapter VII, Solutions in series. Examples XIV. page 177
Problem number : 5
Date solved : Tuesday, September 30, 2025 at 04:25:06 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using series method with expansion around

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