15.15.12 problem 13

Internal problem ID [3216]
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 : 13
Date solved : Tuesday, March 04, 2025 at 04:06:14 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y&=x \sin \left (2 x \right ) \end{align*}

Maple. Time used: 0.005 (sec). Leaf size: 28
ode:=diff(diff(y(x),x),x)-y(x) = x*sin(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = c_2 \,{\mathrm e}^{x}+{\mathrm e}^{-x} c_{1} -\frac {4 \cos \left (2 x \right )}{25}-\frac {\sin \left (2 x \right ) x}{5} \]
Mathematica. Time used: 0.019 (sec). Leaf size: 37
ode=D[y[x],{x,2}]-y[x]==x*Sin[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {1}{5} x \sin (2 x)-\frac {4}{25} \cos (2 x)+c_1 e^x+c_2 e^{-x} \]
Sympy. Time used: 0.112 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*sin(2*x) - y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- x} + C_{2} e^{x} - \frac {x \sin {\left (2 x \right )}}{5} - \frac {4 \cos {\left (2 x \right )}}{25} \]