Solve second order differential equation with Heaviside function using Laplace transform The equation is:
$$y'' + 3y = u_4(t)\cos(5(t-4)), \quad y(0) = 0, \quad y'(0) = -2$$
Here $u_4$ is the Heaviside function with activation switch at $t=4$.
I can get all the way to the partial fraction decomposition but then we get strange coefficients like $45/999$ for $S$ and so on!
Can someone help me? That surely can't be right!
First I get $L(y)$ which ends up being $$L(y) = e^{-4s}\frac{s}{(s^2+25)(s^2+3)}-\frac{2}{s^2+3}$$
Then I try doing partial fraction decomposition on the first bit by making $(s/((s^2+25)(s^2+3)) $equal to$ (As+B)/(s^2+25) + (Cs+D)/(s^2+3)$ but then I get the awkward coefficients..
 A: We are given:
$$y'' + 3y = u_4(t) \cos(5(t-4)) = u(t-4) \cos(5(t-4)), y(0) = 0, y'(0) = -2$$
We have:


*

*$\mathscr{L} (y''(t)) = s^2 y(s) - s y(0) - y'(0) = s^2 y(s) +2$

*$\mathscr{L} (3y(t)) = 3 y(s)$

*$\mathscr{L} (u_4(t)\cos(5(t-4))) = \dfrac{e^{-4 s} s}{s^2+25}$


From this we write:
$$(s^2 + 3)y(s) = \frac{s~e^{-4 s}}{s^2+25} - 2$$
Solving for $y(s)$ yields:
$y(s) = \dfrac{1}{s^2+3}\left( \dfrac{e^{-4 s} s}{s^2+25}-2\right) = -\dfrac{2}{s^2+3} +\dfrac{e^{-4 s} s}{\left(s^2+3\right) \left(s^2+25\right)}$, so 
$$y(s) = -\dfrac{2}{s^2+3}+ e^{-4 s}\left( \dfrac{s}{22 \left(s^2+3\right)}-\dfrac{s}{22 \left(s^2+25\right)}\right)$$
The inverse Laplace transform, using a Table of Laplace Transforms is given by:
$$\mathscr{L}^{-1}(y(s)) = y(t) = -\frac{2 \sin \left(\sqrt{3} t\right)}{\sqrt{3}} + \frac{1}{22} u(t-4) \left(\cos \left(\sqrt{3} (t-4)\right)-\cos (5 (t-4))\right)$$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{{\rm y}''\pars{t} + 3{\rm y}\pars{t}
     =
     \Theta\pars{t - 4}\cos\pars{5\bracks{t - 4}}\,,\qquad{\rm y}\pars{0} = 0\,,
     \quad {\rm y}'\pars{0} = -2}$

\begin{align}
{\rm y}\pars{t}&=
-\,{2\root{3} \over 3}\,\sin\pars{\root{3}t}
+\int_{-\infty}^{\infty}{\rm G}\pars{t,t'}
\Theta\pars{t' - 4}\cos\pars{5\bracks{t' - 4}}\,\dd t'
\\[3mm]&=-\,{2\root{3} \over 3}\,\sin\pars{\root{3}t}
+\int_{4}^{\infty}{\rm G}\pars{t,t'}
\cos\pars{5\bracks{t' - 4}}\,\dd t'
\end{align}
  where $\ds{{\rm G}\pars{t,t'}}$ satisfies
  $$
\pars{\partiald[2]{}{t} + 3}{\rm G}\pars{t,t'} = 0\quad\mbox{if}\quad t \not= t'
\quad\mbox{and}\quad\left\vert%
\begin{array}{rcl}
{\rm G}\pars{0,t'} & = & 0\,,\quad \forall\ t'
\\[3mm]
\left.\partiald{{\rm G}\pars{t,t'}}{t}\right\vert_{t\ =\ 0} & = & 0\,,
\quad \forall\ t'
\\[3mm]
\left.\partiald{{\rm G}\pars{t,t'}}{t}\right\vert_{t\ =\ t'^{-}}^{t\ =\ t'^{+}}
& = & 1 
\end{array}\right.
$$

Then
$$
{\rm G}\pars{t,t'}
=\left\lbrace%
\begin{array}{lcl}
0 & \mbox{if} & t < t'
\\[3mm]
{\root{3} \over 3}\,\sin\pars{\root{3}\bracks{t - t'}} & \mbox{if} & t > t'
\end{array}\right.
$$

\begin{align}
{\rm y}\pars{t}&=-\,{2\root{3} \over 3}\,\sin\pars{\root{3}t}
\\[3mm]&\phantom{=}\mbox{}+\int_{4}^{\infty}\Theta\pars{t - t'}{\root{3} \over 3}\,
\sin\pars{\root{3}\bracks{t - t'}}
\cos\pars{5\bracks{t' - 4}}\,\dd t'
\\[3mm]&=-\,{2\root{3} \over 3}\,\sin\pars{\root{3}t}
\\[3mm]&\phantom{=}\mbox{}+\Theta\pars{t - 4}\,{\root{3} \over 3}\
\underbrace{\int_{4}^{t}\sin\pars{\root{3}\bracks{t - t'}}
\cos\pars{5\bracks{t' - 4}}\,\dd t'}
_{\ds{{\root{3} \over 22}\braces{\cos\pars{\root{3}\bracks{t - 4}} - \cos\pars{5\bracks{t - 4}}}}}
\end{align}

$$\color{#00f}{%
{\rm y}\pars{t}=-\,{2\root{3} \over 3}\,\sin\pars{\root{3}t}
+\Theta\pars{t - 4}\,{\cos\pars{\root{3}\bracks{t - 4}} - \cos\pars{5\bracks{t - 4}} \over 22}}
$$
