36.6.18 problem 21

Internal problem ID [6379]
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 : 21
Date solved : Sunday, March 30, 2025 at 10:53:57 AM
CAS classification : [_linear]

\begin{align*} y^{\prime }-x y&=\sin \left (x \right ) \end{align*}

Using series method with expansion around

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

Maple. Time used: 0.006 (sec). Leaf size: 34
Order:=6; 
ode:=diff(y(x),x)-x*y(x) = sin(x); 
dsolve(ode,y(x),type='series',x=0);
 
\[ y = \left (1+\frac {1}{2} x^{2}+\frac {1}{8} x^{4}\right ) y \left (0\right )+\frac {x^{2}}{2}+\frac {x^{4}}{12}+O\left (x^{6}\right ) \]
Mathematica. Time used: 0.02 (sec). Leaf size: 37
ode=D[y[x],x]-x*y[x]==Sin[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}{8}+\frac {x^2}{2}+1\right ) \]
Sympy. Time used: 0.745 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*y(x) - sin(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics,hint="1st_power_series",x0=0,n=6)
 
\[ y{\left (x \right )} = \frac {x^{2} \left (C_{1} + 1\right )}{2} + \frac {x^{4} \left (3 C_{1} + 2\right )}{24} + C_{1} + O\left (x^{6}\right ) \]