82.31.3 problem Ex. 3

Internal problem ID [18820]
Book : Introductory Course On Differential Equations by Daniel A Murray. Longmans Green and Co. NY. 1924
Section : Chapter VI. Linear equations with constant coefficients. problems at page 79
Problem number : Ex. 3
Date solved : Monday, March 31, 2025 at 06:15:42 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 y&=x^{2} {\mathrm e}^{3 x}+{\mathrm e}^{x} \cos \left (2 x \right ) \end{align*}

Maple. Time used: 0.026 (sec). Leaf size: 52
ode:=diff(diff(y(x),x),x)+2*y(x) = x^2*exp(3*x)+exp(x)*cos(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \cos \left (\sqrt {2}\, x \right ) c_1 +\sin \left (\sqrt {2}\, x \right ) c_2 +\frac {\left (121 x^{2}-132 x +50\right ) {\mathrm e}^{3 x}}{1331}-\frac {{\mathrm e}^{x} \left (\cos \left (2 x \right )-4 \sin \left (2 x \right )\right )}{17} \]
Mathematica. Time used: 2.115 (sec). Leaf size: 81
ode=D[y[x],{x,2}]+2*y[x]==x^2*Exp[3*x]+Exp[x]*Cos[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{11} e^{3 x} x^2-\frac {12}{121} e^{3 x} x+\frac {50 e^{3 x}}{1331}+\frac {4}{17} e^x \sin (2 x)-\frac {1}{17} e^x \cos (2 x)+c_1 \cos \left (\sqrt {2} x\right )+c_2 \sin \left (\sqrt {2} x\right ) \]
Sympy. Time used: 0.193 (sec). Leaf size: 73
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*exp(3*x) + 2*y(x) - exp(x)*cos(2*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (\sqrt {2} x \right )} + C_{2} \cos {\left (\sqrt {2} x \right )} + \frac {x^{2} e^{3 x}}{11} - \frac {12 x e^{3 x}}{121} + \frac {50 e^{3 x}}{1331} + \frac {4 e^{x} \sin {\left (2 x \right )}}{17} - \frac {e^{x} \cos {\left (2 x \right )}}{17} \]