64.11.14 problem 14

Internal problem ID [13385]
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 : 14
Date solved : Wednesday, March 05, 2025 at 09:51:38 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.006 (sec). Leaf size: 39
ode:=diff(diff(y(x),x),x)+diff(y(x),x)-2*y(x) = 6*exp(-2*x)+3*exp(x)-4*x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-2 x} \left (\left (2 x^{2}+2 x +3\right ) {\mathrm e}^{2 x}+\left (c_{1} +x -\frac {1}{3}\right ) {\mathrm e}^{3 x}-2 x +c_{2} -\frac {2}{3}\right ) \]
Mathematica. Time used: 1.658 (sec). Leaf size: 90
ode=D[y[x],{x,2}]+D[y[x],x]-2*y[x]==6*Exp[-2*x]+3*Exp[x]-4*x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-2 x} \left (\int _1^x\left (\frac {4}{3} e^{2 K[1]} K[1]^2-e^{3 K[1]}-2\right )dK[1]+e^{3 x} \int _1^x\left (-\frac {4}{3} e^{-K[2]} K[2]^2+2 e^{-3 K[2]}+1\right )dK[2]+c_2 e^{3 x}+c_1\right ) \]
Sympy. Time used: 0.242 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*x**2 - 2*y(x) - 3*exp(x) + Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 6*exp(-2*x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = 2 x^{2} + 2 x + \left (C_{1} - 2 x\right ) e^{- 2 x} + \left (C_{2} + x\right ) e^{x} + 3 \]