49.2.5 problem 1(e)

Internal problem ID [7595]
Book : An introduction to Ordinary Differential Equations. Earl A. Coddington. Dover. NY 1961
Section : Chapter 1.6 Introduction– Linear equations of First Order. Page 41
Problem number : 1(e)
Date solved : Wednesday, March 05, 2025 at 04:47:25 AM
CAS classification : [[_linear, `class A`]]

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

Maple. Time used: 0.003 (sec). Leaf size: 20
ode:=diff(y(x),x)+3*y(x) = exp(I*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {{\mathrm e}^{-3 x} \left (\left (-3+i\right ) {\mathrm e}^{\left (3+i\right ) x}-10 c_{1} \right )}{10} \]
Mathematica. Time used: 0.057 (sec). Leaf size: 29
ode=D[y[x],x]+3*y[x]==Exp[I*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \left (\frac {3}{10}-\frac {i}{10}\right ) e^{i x}+c_1 e^{-3 x} \]
Sympy. Time used: 0.206 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(3*y(x) - exp(x*complex(0, 1)) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- 3 x} + \frac {e^{x \operatorname {complex}{\left (0,1 \right )}}}{\operatorname {complex}{\left (0,1 \right )} + 3} \]