83.16.3 problem 3

Internal problem ID [19121]
Book : A Text book for differentional equations for postgraduate students by Ray and Chaturvedi. First edition, 1958. BHASKAR press. INDIA
Section : Chapter III. Ordinary linear differential equations with constant coefficients. Exercise III (H) at page 47
Problem number : 3
Date solved : Monday, March 31, 2025 at 06:48:57 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-2 y^{\prime }+4 y&={\mathrm e}^{x} \cos \left (x \right ) \end{align*}

Maple. Time used: 0.004 (sec). Leaf size: 29
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+4*y(x) = exp(x)*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{x} \left (2 c_2 \sin \left (\sqrt {3}\, x \right )+2 c_1 \cos \left (\sqrt {3}\, x \right )+\cos \left (x \right )\right )}{2} \]
Mathematica. Time used: 0.108 (sec). Leaf size: 39
ode=D[y[x],{x,2}]-2*D[y[x],x]+4*y[x]==Exp[x]*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{2} e^x \left (\cos (x)+2 c_2 \cos \left (\sqrt {3} x\right )+2 c_1 \sin \left (\sqrt {3} x\right )\right ) \]
Sympy. Time used: 0.231 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) - exp(x)*cos(x) - 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} \sin {\left (\sqrt {3} x \right )} + C_{2} \cos {\left (\sqrt {3} x \right )} + \frac {\cos {\left (x \right )}}{2}\right ) e^{x} \]