15.22.2 problem 2

Internal problem ID [3336]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 40, page 186
Problem number : 2
Date solved : Tuesday, March 04, 2025 at 04:36:21 PM
CAS classification : [_linear]

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

Using series method with expansion around

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

With initial conditions

\begin{align*} y \left (0\right )&=2 \end{align*}

Maple. Time used: 0.000 (sec). Leaf size: 16
Order:=5; 
ode:=diff(y(x),x) = x*y(x)-x^2; 
ic:=y(0) = 2; 
dsolve([ode,ic],y(x),type='series',x=0);
 
\[ y \left (x \right ) = 2+x^{2}-\frac {1}{3} x^{3}+\frac {1}{4} x^{4}+\operatorname {O}\left (x^{5}\right ) \]
Mathematica. Time used: 0.004 (sec). Leaf size: 22
ode=D[y[x],x]==x*y[x]-x^2; 
ic={y[0]==2}; 
AsymptoticDSolveValue[{ode,ic},y[x],{x,0,4}]
 
\[ y(x)\to \frac {x^4}{4}-\frac {x^3}{3}+x^2+2 \]
Sympy. Time used: 0.712 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2 - x*y(x) + Derivative(y(x), x),0) 
ics = {y(0): 2} 
dsolve(ode,func=y(x),ics=ics,hint="1st_power_series",x0=0,n=5)
 
\[ y{\left (x \right )} = 2 + x^{2} - \frac {x^{3}}{3} + \frac {x^{4}}{4} + O\left (x^{5}\right ) \]