30.14.22 problem 25

Internal problem ID [7671]
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 : 25
Date solved : Tuesday, September 30, 2025 at 04:55:44 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} \left (x^{2}+1\right ) y^{\prime \prime }-x y^{\prime }+y&=\cos \left (x \right ) \end{align*}

Using series method with expansion around

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