29.6.31 problem 37

Internal problem ID [7316]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 6. SECOND-ORDER LINEAR EQUATIONSWITH CONSTANT COEFFICIENTS AND RIGHT-HAND SIDE NOT ZERO. page 422
Problem number : 37
Date solved : Tuesday, September 30, 2025 at 04:28:09 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 y^{\prime }+y&=4 \,{\mathrm e}^{x}+\left (1-x \right ) \left ({\mathrm e}^{2 x}-1\right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 30
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+y(x) = 4*exp(x)+(1-x)*(exp(2*x)-1); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -3+\left (c_1 x +c_2 \right ) {\mathrm e}^{-x}+\frac {\left (-3 x +5\right ) {\mathrm e}^{2 x}}{27}+x +{\mathrm e}^{x} \]
Mathematica. Time used: 0.377 (sec). Leaf size: 91
ode=D[y[x],{x,2}]+2*D[y[x],x]+y[x]==4*Exp[x]+(1-x)*(Exp[2*x]-1); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (\int _1^xe^{K[1]} \left (e^{2 K[1]} (K[1]-1)-4 e^{K[1]}-K[1]+1\right ) K[1]dK[1]+x \int _1^xe^{K[2]} \left (-e^{2 K[2]} (K[2]-1)+4 e^{K[2]}+K[2]-1\right )dK[2]+c_2 x+c_1\right ) \end{align*}
Sympy. Time used: 0.173 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((x - 1)*(exp(2*x) - 1) + y(x) - 4*exp(x) + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x + \frac {\left (5 - 3 x\right ) e^{2 x}}{27} + \left (C_{1} + C_{2} x\right ) e^{- x} + e^{x} - 3 \]