35.8.20 problem 20

Internal problem ID [6227]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 13. Miscellaneous problems. page 466
Problem number : 20
Date solved : Sunday, March 30, 2025 at 10:43:56 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 36
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+5*y(x) = 5*x+4*exp(x)*(1+sin(2*x)); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {2}{5}-{\mathrm e}^{x} \left (x -c_1 -1\right ) \cos \left (2 x \right )+\frac {\left (2 c_2 +1\right ) {\mathrm e}^{x} \sin \left (2 x \right )}{2}+x +{\mathrm e}^{x} \]
Mathematica. Time used: 1.13 (sec). Leaf size: 45
ode=D[y[x],{x,2}]-2*D[y[x],x]+5*y[x]==5*x+4*Exp[x]*(1+Sin[2*x]); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x+e^x-e^x (x-c_2) \cos (2 x)+\frac {1}{4} (1+4 c_1) e^x \sin (2 x)+\frac {2}{5} \]
Sympy. Time used: 0.351 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-5*x - (4*sin(2*x) + 4)*exp(x) + 5*y(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 + \left (C_{2} \sin {\left (2 x \right )} + \left (C_{1} - x\right ) \cos {\left (2 x \right )} + 1\right ) e^{x} + \frac {2}{5} \]