32.8.3 problem Exercise 21.5, page 231

Internal problem ID [5952]
Book : Ordinary Differential Equations, By Tenenbaum and Pollard. Dover, NY 1963
Section : Chapter 4. Higher order linear differential equations. Lesson 21. Undetermined Coefficients
Problem number : Exercise 21.5, page 231
Date solved : Tuesday, March 04, 2025 at 11:59:50 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y^{\prime \prime }+3 y^{\prime }+2 y&={\mathrm e}^{i x} \end{align*}

Maple. Time used: 0.000 (sec). Leaf size: 24
ode:=diff(diff(y(x),x),x)+3*diff(y(x),x)+2*y(x) = exp(I*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = {\mathrm e}^{-x} \left (\left (\frac {1}{10}-\frac {3 i}{10}\right ) {\mathrm e}^{\left (1+i\right ) x}-{\mathrm e}^{-x} c_{1} +c_{2} \right ) \]
Mathematica. Time used: 0.054 (sec). Leaf size: 37
ode=D[y[x],{x,2}]+3*D[y[x],x]+2*y[x]==Exp[I*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \left (\frac {1}{10}-\frac {3 i}{10}\right ) e^{i x}+c_1 e^{-2 x}+c_2 e^{-x} \]
Sympy. Time used: 0.216 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*y(x) - exp(x*complex(0, 1)) + 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 {e^{x \operatorname {complex}{\left (0,1 \right )}}}{\operatorname {complex}^{2}{\left (0,1 \right )} + 3 \operatorname {complex}{\left (0,1 \right )} + 2} \]