7.11.9 problem 9

Internal problem ID [330]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 2. Linear Equations of Higher Order. Section 2.5 (Nonhomogeneous equations and undetermined coefficients). Problems at page 161
Problem number : 9
Date solved : Tuesday, March 04, 2025 at 11:10:26 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 36
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)-3*y(x) = 1+x*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (\left (x^{2}-\frac {1}{2} x +8 c_1 +\frac {1}{8}\right ) {\mathrm e}^{4 x}+8 c_2 -\frac {8 \,{\mathrm e}^{3 x}}{3}\right ) {\mathrm e}^{-3 x}}{8} \]
Mathematica. Time used: 0.141 (sec). Leaf size: 38
ode=D[y[x],{x,2}]+2*D[y[x],x]-3*y[x]==1+x*Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{64} e^x \left (8 x^2-4 x+1+64 c_2\right )+c_1 e^{-3 x}-\frac {1}{3} \]
Sympy. Time used: 0.267 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(x) - 3*y(x) + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} e^{- 3 x} + \left (C_{1} + \frac {x^{2}}{8} - \frac {x}{16}\right ) e^{x} - \frac {1}{3} \]