44.3.4 problem 1(d)

Internal problem ID [9114]
Book : Differential Equations: Theory, Technique, and Practice by George Simmons, Steven Krantz. McGraw-Hill NY. 2007. 1st Edition.
Section : Chapter 1. What is a differential equation. Section 1.4 First Order Linear Equations. Page 15
Problem number : 1(d)
Date solved : Tuesday, September 30, 2025 at 06:04:40 PM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+y&=2 x \,{\mathrm e}^{-x}+x^{2} \end{align*}
Maple. Time used: 0.001 (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.048 (sec). Leaf size: 33
ode=D[y[x],x]+y[x]==2*x*Exp[-x]+x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (\int _1^xK[1] \left (e^{K[1]} K[1]+2\right )dK[1]+c_1\right ) \end{align*}
Sympy. Time used: 0.100 (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 \]