89.18.22 problem 22

Internal problem ID [24722]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 9. Nonhomogeneous Equations: Undetermined coefficients. Oral Exercises at page 146
Problem number : 22
Date solved : Thursday, October 02, 2025 at 10:47:27 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+2 y^{\prime }+y^{\prime \prime }&=7+{\mathrm e}^{x}+{\mathrm e}^{2 x} \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+y(x) = 7+exp(x)+exp(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{2 x}}{9}+7+\left (c_1 x +c_2 \right ) {\mathrm e}^{-x}+\frac {{\mathrm e}^{x}}{4} \]
Mathematica. Time used: 0.144 (sec). Leaf size: 36
ode=D[y[x],{x,2}]+2*D[y[x],x]+y[x]==7+Exp[x]+Exp[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {e^x}{4}+\frac {e^{2 x}}{9}+e^{-x} (c_2 x+c_1)+7 \end{align*}
Sympy. Time used: 0.137 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - exp(2*x) - exp(x) + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 7,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + C_{2} x\right ) e^{- x} + \frac {e^{2 x}}{9} + \frac {e^{x}}{4} + 7 \]