64.11.35 problem 35

Internal problem ID [13406]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 4, Section 4.3. The method of undetermined coefficients. Exercises page 151
Problem number : 35
Date solved : Wednesday, March 05, 2025 at 09:52:29 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

With initial conditions

\begin{align*} y \left (0\right )&=1\\ y^{\prime }\left (0\right )&=0 \end{align*}

Maple. Time used: 0.022 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+y(x) = 2*exp(2*x)*x+6*exp(x); 
ic:=y(0) = 1, D(y)(0) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \left (2 x -4\right ) {\mathrm e}^{2 x}+{\mathrm e}^{x} \left (3 x^{2}+x +5\right ) \]
Mathematica. Time used: 0.107 (sec). Leaf size: 94
ode=D[y[x],{x,2}]-2*D[y[x],x]+y[x]==2*x*Exp[2*x]+6*Exp[x]; 
ic={y[0]==1,Derivative[1][y][0] ==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -e^x \left (x \int _1^0\left (2 e^{K[2]} K[2]+6\right )dK[2]-x \int _1^x\left (2 e^{K[2]} K[2]+6\right )dK[2]-\int _1^x-2 K[1] \left (e^{K[1]} K[1]+3\right )dK[1]+\int _1^0-2 K[1] \left (e^{K[1]} K[1]+3\right )dK[1]+x-1\right ) \]
Sympy. Time used: 0.261 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x*exp(2*x) + y(x) - 6*exp(x) - 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 1, Subs(Derivative(y(x), x), x, 0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (x \left (3 x + 2 e^{x} + 1\right ) - 4 e^{x} + 5\right ) e^{x} \]