23.3.16 problem 8(f)

Internal problem ID [4157]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 4. The general linear differential equation of order n. Exercises at page 63
Problem number : 8(f)
Date solved : Sunday, March 30, 2025 at 02:41:12 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 40
ode:=diff(diff(y(x),x),x)+3*diff(y(x),x)+2*y(x) = x*sin(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (-30 x +7\right ) \cos \left (2 x \right )}{200}+\frac {\left (12-5 x \right ) \sin \left (2 x \right )}{100}-{\mathrm e}^{-2 x} c_1 +{\mathrm e}^{-x} c_2 \]
Mathematica. Time used: 0.024 (sec). Leaf size: 48
ode=D[y[x],{x,2}]+3*D[y[x],x]+2*y[x]==x*Sin[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to c_1 e^{-2 x}+c_2 e^{-x}+\frac {1}{200} (2 (12-5 x) \sin (2 x)+(7-30 x) \cos (2 x)) \]
Sympy. Time used: 0.284 (sec). Leaf size: 49
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*sin(2*x) + 2*y(x) + 3*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- 2 x} + C_{2} e^{- x} - \frac {x \sin {\left (2 x \right )}}{20} - \frac {3 x \cos {\left (2 x \right )}}{20} + \frac {3 \sin {\left (2 x \right )}}{25} + \frac {7 \cos {\left (2 x \right )}}{200} \]