36.6.20 problem 23

Internal problem ID [6381]
Book : Fundamentals of Differential Equations. By Nagle, Saff and Snider. 9th edition. Boston. Pearson 2018.
Section : Chapter 8, Series solutions of differential equations. Section 8.4. page 449
Problem number : 23
Date solved : Sunday, March 30, 2025 at 10:53:59 AM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

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

Using series method with expansion around

\begin{align*} 0 \end{align*}

Maple. Time used: 0.005 (sec). Leaf size: 59
Order:=6; 
ode:=diff(diff(z(x),x),x)+x*diff(z(x),x)+z(x) = x^2+2*x+1; 
dsolve(ode,z(x),type='series',x=0);
 
\[ z = \left (1-\frac {1}{2} x^{2}+\frac {1}{8} x^{4}\right ) z \left (0\right )+\left (x -\frac {1}{3} x^{3}+\frac {1}{15} x^{5}\right ) z^{\prime }\left (0\right )+\frac {x^{2}}{2}+\frac {x^{3}}{3}-\frac {x^{4}}{24}-\frac {x^{5}}{15}+O\left (x^{6}\right ) \]
Mathematica. Time used: 0.014 (sec). Leaf size: 70
ode=D[z[x],{x,2}]+x*D[z[x],x]+z[x]==x^2+2*x+1; 
ic={}; 
AsymptoticDSolveValue[{ode,ic},z[x],{x,0,5}]
 
\[ z(x)\to -\frac {x^5}{15}-\frac {x^4}{24}+\frac {x^3}{3}+\frac {x^2}{2}+c_2 \left (\frac {x^5}{15}-\frac {x^3}{3}+x\right )+c_1 \left (\frac {x^4}{8}-\frac {x^2}{2}+1\right ) \]
Sympy
from sympy import * 
x = symbols("x") 
z = Function("z") 
ode = Eq(-x**2 + x*Derivative(z(x), x) - 2*x + z(x) + Derivative(z(x), (x, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=z(x),ics=ics,hint="2nd_power_series_regular",x0=0,n=6)
 
ValueError : ODE -x**2 + x*Derivative(z(x), x) - 2*x + z(x) + Derivative(z(x), (x, 2)) - 1 does not match hint 2nd_power_series_regular