81.14.15 problem 18-28

Internal problem ID [21700]
Book : The Differential Equations Problem Solver. VOL. I. M. Fogiel director. REA, NY. 1978. ISBN 78-63609
Section : Chapter 18. Algebra of differential operators. Page 435
Problem number : 18-28
Date solved : Thursday, October 02, 2025 at 08:00:07 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=x \,{\mathrm e}^{x} \cos \left (x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 34
ode:=diff(diff(y(x),x),x)+y(x) = x*exp(x)*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (\left (5 x -2\right ) \cos \left (x \right )+\left (10 x -14\right ) \sin \left (x \right )\right ) {\mathrm e}^{x}}{25}+\cos \left (x \right ) c_1 +\sin \left (x \right ) c_2 \]
Mathematica. Time used: 0.015 (sec). Leaf size: 41
ode=D[y[x],{x,2}]+y[x]==x*Exp[x]*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{25} e^x (2 (5 x-7) \sin (x)+(5 x-2) \cos (x))+c_1 \cos (x)+c_2 \sin (x) \end{align*}
Sympy. Time used: 0.097 (sec). Leaf size: 41
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(x)*cos(x) + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + \frac {x e^{x}}{5} - \frac {2 e^{x}}{25}\right ) \cos {\left (x \right )} + \left (C_{2} + \frac {2 x e^{x}}{5} - \frac {14 e^{x}}{25}\right ) \sin {\left (x \right )} \]