26.4.4 problem 2(d)

Internal problem ID [4272]
Book : Differential equations with applications and historial notes, George F. Simmons. Second edition. 1971
Section : Chapter 2, section 11, page 49
Problem number : 2(d)
Date solved : Sunday, March 30, 2025 at 02:48:24 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+y&=2 x \,{\mathrm e}^{-x}+x^{2} \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 22
ode:=diff(y(x),x)+y(x) = 2*x*exp(-x)+x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (x^{2}+c_1 \right ) {\mathrm e}^{-x}+x^{2}-2 x +2 \]
Mathematica. Time used: 0.133 (sec). Leaf size: 29
ode=D[y[x],x]+y[x]==2*x*Exp[-x]+x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-x} \left (x^2+e^x \left (x^2-2 x+2\right )+c_1\right ) \]
Sympy. Time used: 0.162 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 - 2*x*exp(-x) + y(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x^{2} - 2 x + \left (C_{1} + x^{2}\right ) e^{- x} + 2 \]