49.10.6 problem 1(f)

Internal problem ID [7664]
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 : Wednesday, March 05, 2025 at 04:49:52 AM
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.018 (sec). Leaf size: 54
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 = -1+\cos \left (\frac {x}{2}\right )^{2} \left (x^{2}+2 i x +2\right )+\sin \left (\frac {x}{2}\right ) \left (i x -2\right ) x \cos \left (\frac {x}{2}\right )+\left (c_{1} x +c_{2} \right ) {\mathrm e}^{i x}-i x -\frac {x^{2}}{2} \]
Mathematica. Time used: 0.286 (sec). Leaf size: 39
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]
 
\[ y(x)\to \frac {1}{2} e^{-i x} \left (1+e^{2 i x} \left (x^2+2 c_2 x+2 c_1\right )\right ) \]
Sympy. Time used: 0.626 (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} \]