23.3.64 problem 66

Internal problem ID [5778]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 3. THE DIFFERENTIAL EQUATION IS LINEAR AND OF SECOND ORDER, page 311
Problem number : 66
Date solved : Tuesday, September 30, 2025 at 02:02:57 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+2 y^{\prime }+y^{\prime \prime }&=3 \,{\mathrm e}^{2 x}+x^{2}-\cos \left (x \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 32
ode:=y(x)+2*diff(y(x),x)+diff(diff(y(x),x),x) = 3*exp(2*x)+x^2-cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = 6+\left (c_1 x +c_2 \right ) {\mathrm e}^{-x}+x^{2}-4 x -\frac {\sin \left (x \right )}{2}+\frac {{\mathrm e}^{2 x}}{3} \]
Mathematica. Time used: 0.146 (sec). Leaf size: 41
ode=y[x] + 2*D[y[x],x] + D[y[x],{x,2}] == 3*E^(2*x) + x^2 - Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x^2-4 x+\frac {e^{2 x}}{3}-\frac {\sin (x)}{2}+e^{-x} (c_2 x+c_1)+6 \end{align*}
Sympy. Time used: 0.188 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + y(x) - 3*exp(2*x) + cos(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^{2} - 4 x + \left (C_{1} + C_{2} x\right ) e^{- x} + \frac {e^{2 x}}{3} - \frac {\sin {\left (x \right )}}{2} + 6 \]