38.4.19 problem 20

Internal problem ID [6505]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 25. Second order differential equations. Further problems 25. page 1094
Problem number : 20
Date solved : Wednesday, March 05, 2025 at 12:53:48 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+5 x^{\prime }+6 x&=\cos \left (t \right ) \end{align*}

With initial conditions

\begin{align*} x \left (0\right )&={\frac {1}{10}}\\ x^{\prime }\left (0\right )&=0 \end{align*}

Maple. Time used: 0.011 (sec). Leaf size: 25
ode:=diff(diff(x(t),t),t)+5*diff(x(t),t)+6*x(t) = cos(t); 
ic:=x(0) = 1/10, D(x)(0) = 0; 
dsolve([ode,ic],x(t), singsol=all);
 
\[ x \left (t \right ) = \frac {{\mathrm e}^{-3 t}}{10}-\frac {{\mathrm e}^{-2 t}}{10}+\frac {\cos \left (t \right )}{10}+\frac {\sin \left (t \right )}{10} \]
Mathematica. Time used: 0.056 (sec). Leaf size: 26
ode=D[x[t],{t,2}]+5*D[x[t],t]+6*x[t]==Cos[t]; 
ic={x[0]==1/10,Derivative[1][x][0 ]==0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to \frac {1}{10} \left (e^{-3 t}-e^{-2 t}+\sin (t)+\cos (t)\right ) \]
Sympy. Time used: 0.238 (sec). Leaf size: 29
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(6*x(t) - cos(t) + 5*Derivative(x(t), t) + Derivative(x(t), (t, 2)),0) 
ics = {x(0): 1/10, Subs(Derivative(x(t), t), t, 0): 0} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = \frac {\sin {\left (t \right )}}{10} + \frac {\cos {\left (t \right )}}{10} - \frac {e^{- 2 t}}{10} + \frac {e^{- 3 t}}{10} \]