71.13.6 problem 6

Internal problem ID [14455]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 5. The Laplace Transform Method. Exercises 5.2, page 248
Problem number : 6
Date solved : Monday, March 31, 2025 at 12:27:33 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using Laplace method

Maple. Time used: 0.104 (sec). Leaf size: 52
ode:=diff(diff(y(x),x),x)+diff(y(x),x)-2*y(x) = x*exp(x)-3*x^2; 
dsolve(ode,y(x),method='laplace');
 
\[ y = \frac {9}{4}+\frac {3 x^{2}}{2}+\frac {3 x}{2}+\frac {{\mathrm e}^{x} \left (9 x^{2}+36 y \left (0\right )+18 y^{\prime }\left (0\right )-6 x -106\right )}{54}+\frac {{\mathrm e}^{-2 x} \left (36 y \left (0\right )-36 y^{\prime }\left (0\right )-31\right )}{108} \]
Mathematica. Time used: 0.381 (sec). Leaf size: 81
ode=D[y[x],{x,2}]+D[y[x],x]-2*y[x]==x*Exp[x]-3*x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-2 x} \left (\int _1^x-\frac {1}{3} e^{2 K[1]} \left (e^{K[1]}-3 K[1]\right ) K[1]dK[1]+e^{3 x} \int _1^x\frac {1}{3} K[2] \left (1-3 e^{-K[2]} K[2]\right )dK[2]+c_2 e^{3 x}+c_1\right ) \]
Sympy. Time used: 0.214 (sec). Leaf size: 37
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(3*x**2 - x*exp(x) - 2*y(x) + Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} e^{- 2 x} + \frac {3 x^{2}}{2} + \frac {3 x}{2} + \left (C_{1} + \frac {x^{2}}{6} - \frac {x}{9}\right ) e^{x} + \frac {9}{4} \]