43.11.6 problem 1(f)

Internal problem ID [8956]
Book : An introduction to Ordinary Differential Equations. Earl A. Coddington. Dover. NY 1961
Section : Chapter 2. Linear equations with constant coefficients. Page 93
Problem number : 1(f)
Date solved : Tuesday, September 30, 2025 at 06:00:31 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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