15.15.15 problem 16

Internal problem ID [3219]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 24, page 109
Problem number : 16
Date solved : Sunday, March 30, 2025 at 01:21:35 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 37
ode:=diff(diff(y(x),x),x)-4*y(x) = x*exp(2*x)*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (\left (-17 x +76\right ) \cos \left (x \right )+\left (68 x +2\right ) \sin \left (x \right )+289 c_2 \right ) {\mathrm e}^{2 x}}{289}+{\mathrm e}^{-2 x} c_1 \]
Mathematica. Time used: 0.028 (sec). Leaf size: 49
ode=D[y[x],{x,2}]-4*y[x]==x*Exp[2*x]*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to c_1 e^{2 x}+c_2 e^{-2 x}+\frac {1}{289} e^{2 x} (2 (34 x+1) \sin (x)+(76-17 x) \cos (x)) \]
Sympy. Time used: 0.213 (sec). Leaf size: 44
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(2*x)*cos(x) - 4*y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} e^{- 2 x} + \left (C_{1} + \frac {4 x \sin {\left (x \right )}}{17} - \frac {x \cos {\left (x \right )}}{17} + \frac {2 \sin {\left (x \right )}}{289} + \frac {76 \cos {\left (x \right )}}{289}\right ) e^{2 x} \]