35.6.31 problem 37

Internal problem ID [6181]
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 : Sunday, March 30, 2025 at 10:42:12 AM
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)*(-1+exp(2*x)); 
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.654 (sec). Leaf size: 38
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]
 
\[ y(x)\to \frac {1}{27} e^{2 x} (5-3 x)+e^x+x+e^{-x} (c_2 x+c_1)-3 \]
Sympy. Time used: 0.287 (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 \]