43.10.6 problem 1(f)

Internal problem ID [8950]
Book : An introduction to Ordinary Differential Equations. Earl A. Coddington. Dover. NY 1961
Section : Chapter 2. Linear equations with constant coefficients. Page 89
Problem number : 1(f)
Date solved : Tuesday, September 30, 2025 at 06:00:26 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-2 i y^{\prime }-y&={\mathrm e}^{i x}-2 \,{\mathrm e}^{-i x} \end{align*}
Maple. Time used: 0.006 (sec). Leaf size: 28
ode:=diff(diff(y(x),x),x)-2*I*diff(y(x),x)-y(x) = exp(I*x)-2*exp(-I*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{-i x}}{2}+\frac {\left (2 c_1 x +x^{2}+2 c_2 \right ) {\mathrm e}^{i x}}{2} \]
Mathematica. Time used: 0.205 (sec). Leaf size: 66
ode=D[y[x],{x,2}]-2*I*D[y[x],x]-y[x]==Exp[I*x]-2*Exp[-I*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{i x} \int _1^x\left (-1+2 e^{-2 i K[1]}\right ) K[1]dK[1]+e^{i x} \left (x^2+c_2 x+c_1\right )-i e^{-i x} x \end{align*}
Sympy. Time used: 0.286 (sec). Leaf size: 100
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(complex(0, -2)*Derivative(y(x), x) - y(x) + 2*exp(x*complex(0, -1)) - exp(x*complex(0, 1)) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{\frac {x \left (\sqrt {\operatorname {complex}^{2}{\left (0,-2 \right )} + 4} - \operatorname {complex}{\left (0,-2 \right )}\right )}{2}} + C_{2} e^{- \frac {x \left (\sqrt {\operatorname {complex}^{2}{\left (0,-2 \right )} + 4} + \operatorname {complex}{\left (0,-2 \right )}\right )}{2}} + \frac {e^{x \operatorname {complex}{\left (0,1 \right )}}}{\operatorname {complex}{\left (0,-2 \right )} \operatorname {complex}{\left (0,1 \right )} + \operatorname {complex}^{2}{\left (0,1 \right )} - 1} - \frac {2 e^{x \operatorname {complex}{\left (0,-1 \right )}}}{\operatorname {complex}{\left (0,-2 \right )} \operatorname {complex}{\left (0,-1 \right )} + \operatorname {complex}^{2}{\left (0,-1 \right )} - 1} \]