\documentclass[12pt]{amsart}
%\setlength{\textheight}{9in}
%\setlength{\topmargin}{0in}
%\setlength{\textwidth}{6in}
%\setlength{\oddsidemargin}{0in}
%\setlength{\evensidemargin}{0in}
\usepackage{graphicx}%,psfrag}

\newcommand{\dis}{\displaystyle}
%\newcommand{\bd}{\partial}

%%% Add Color
\usepackage[usenames,dvipsnames]{xcolor}
\newcommand{\green}[1]{\textcolor{ForestGreen}{#1}}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\blue}[1]{\textcolor{blue}{#1}}

\begin{document}

\begin{center}{\Large\bf The Laplace Transform}

  \hspace*{0.12in}

  These are lecture notes based on the first three sections of Chapter
6 of Boyce \& DiPrima's textbook. \copyright 2018, Michael C. Sullivan.
\end{center}

\vspace{.2in}

The Laplace transform provides a method of converting an initial
value problem into an algebraic problem. We will apply it to problems
of the form
\[
ay'' + by' + cy = g(t), \:y(0) = y_o\: \& \: y'(0) = v_o.
\]
It is most helpful when the forcing term g(t) is discontinuous. However,
it will take some effort to develop this method before we see
how to use it.

\vspace{.2in}

{\bf Definition.} 
The {\em Laplace transform} of a function $f(t)$ is a new
function $F(s)$ given by
\[
L(f) = F(s) = \int_0^\infty e^{-st} f(t)\, dt.
\]
Note: the domain of $F(s)$ is often restricted to an interval of the
form $(a,\infty)$.

%\vfill\pagebreak

{\bf Example 1.} Let $f(t) = 1$. That is $f$ is a constant function always
equal to one. We will compute its Laplace transform.
\[
L(f) =F(s) = \int_0^\infty e^{-st} \cdot 1\, dt = -\tfrac{1}{s}e^{-st}\big|_0^\infty =  -\tfrac{1}{s}\left(\left[\lim_{t\to\infty} e^{-st}\right]-\left[e^0\right]\right).
\]
Now the limit is zero if $s > 0$. For $s = 0$ the limit is one and for
$s < 0$ the limit is infinity. When this happens, we restrict the domain to $s > 0$. Thus,
\[
F(s) = \tfrac{1}{s}, \:\:\mbox{ for }\:\: s>0.
\]
is the Laplace transform of $f(t) = 1$.

\vspace{.2in}

{\bf Example 2.}
Let $f(t) = \sin t$. We will find its Laplace transform.
\[
L(f) = F(s) = \int_0^\infty e^{-st} \sin t \, dt = -\frac{e^{-st}}{s^2+1}(\cos t + s \sin t)\big|_0^\infty
\]
\[
=\frac{1}{s^2+1}, \:\:\mbox{ provided }\: s>0.
\]
You should work through the details of this calculation, by hand. A
little later we will use the computer, but you need to get your hands
 dirty now and then to get a feel for what is going on.

\vspace{.2in}

{\bf Student Exercise.}
Show that $L(\cos t) = \frac{s}{s^2+1}$, for $s>0$.

\vspace{.2in}

{\bf Example 3.}
Let $f(t)=e^{ct}$. We compute its Laplace transform.
\[
L(f) = F(s) = \int_0^\infty e^{-st}e^{ct} \, dt = \int_0^\infty e^{(c-s)t} \, dt = \frac{e^{c-s}}{c-s}\Big|_0^\infty =
\]
\[
0 - \frac{e^0}{c-s} = \frac{1}{c-s}, \:\:\mbox{provided }\: s>c.
\]

%\vfill\pagebreak

We state a theorem that tells us for which functions $f(t)$ the
Laplace transform exists, then we will do more examples leading up to
how the Laplace transform applies to solving differential equations.
First a definition.

\vspace{.2in}

{\bf Definition.} A function $f(t)$ is said to be {\em dominated by an
  exponential function} if there exist real numbers $a$, $k$ and $m$, with $k$ and $m$ positive, such that
\[
|f(t)| \leq k e^{at} \:\: \mbox{ for all } \: t\geq m.
\]

\vspace{.2in}

{\bf Example 4.} 
Let $f(t) = t^4 \sin t+t^3$. First, on a computer plot $\pm e^t$
and $f(t)$ over $t \in [0, 4]$. You might think that $f(t)$ is not dominated
by $e^t$. Now, redo the plot over the range $t \in [0, 14]$. See?


\vspace{.2in}

{\bf Fact.}
Every polynomial is dominated by an exponential function.

\vspace{.2in}

{\bf Fact.} 
The function $e^{t^2}$ is not dominated by an exponential function.

\vspace{.2in}

{\bf Theorem.}
(6.1.2) Suppose
\begin{itemize}
\item $f(t)$ is piecewise continuous on $[0,\infty)$, and
\item $f(t)$ is dominated by an exponential function.
\end{itemize}
Then $L(f) = F(s)$ exists for $s > a$.

\vspace{.2in}

See the textbook for the proof.

%page 4
%\vfill\pagebreak

The next theorem is just a calculation we will need.

\vspace{.2in}

{\bf Theorem.} For a suitable $f(t)$, see textbook for details, we have
the following formulas.
\\(a) $L(f') = sL(f) - f(0)$.
\\(b) $L(f'') = s^2L(f) - s f(0) - f'(0)$.

\vspace{.2in}

{\bf Proof.}
(a) We use integration by parts.
\[
L(f') = \int_0^\infty e^{-st} f'(t) \, dt = e^{-st}f(t)\big|_0^\infty + s \int_0^\infty e^{-st} f(t)\, dt
  \]
  \[
= - e^0 f(0) + sL(f) = sL(f) - f(0).
  \]
(b) Repeat.
  \[
L(f'')=sL(f')-f'(0)= s(sL(f)-f(0))-f'(0) = s^2L(f)-sf(0)-f'(0).
\]

\vspace{.2in}

{\bf Facts.} You should check that
\begin{itemize}
\item  $L(0)=0$,
\item $L(cf) = cL(f)$, where $c$ is a constant,
\item $L(f(t)+g(t)) = L(f(t)) + L(g(t))$.
\end{itemize}

\vspace{.2in}

We will use these in the next examples.

\vspace{.2in}

{\bf Example 5.} We will use the Laplace transform method to solve
\[
y'' + y = 0, \: y(0) = 0,\: \& \: y'(0) = 1.
\]
We apply the Laplace transform to both sides of $y'' + y = 0$.
\begin{eqnarray*}
  L(y'' + y) &=& L(0). \\
  L(y'') + L(y) &=& 0. \\
  s^2L(y)-sy(0)-y'(0) + L(y) &=& 0.\\
  (s^2+1)L(y) -1 &=& 0.
\end{eqnarray*}
Solving for $L(y)$ gives
\[
L(y) = \frac{1}{s^2+1}.
\]
Now we remember that $L(\sin t) =  \frac{1}{s^2+1}$. We conclude that
$y(t) = \sin t$. Formally, this is called finding the {\em inverse Laplace transform.}
\[
y = L^{-1}\left( \frac{1}{s^2+1}\right) = \sin t.
\]

\vspace{.2in}

{\bf Student Exercise.}
Use the Laplace transform to solve $y'' +y = 0$, with $y(0) = 1$ and $y'(0) = 0$.

\vspace{.2in}

Discuss Table 6.2.1.

\vspace{.2in}

{\bf Example 6.} Given $F(s) = \frac{4}{(s-1)^3}$, find $f(t) = L^{-1}(F)$.
    
\vspace{.2in}
    
\begin{proof}[Solution.]
By Table 6.2.1, item \#11,
\[
L(t^2e^t) = \frac{2}{(s-1)^3}.
\]
Therefore,
\[
L^{-1}(F) = 2t^2 e^t.
\]
\end{proof}

\vspace{.2in}

{\bf Example 7.} Given $F(s) = \frac{2s-3}{s^2-4}$. find $f(t) = L^{-1}(F)$.
    
\vspace{.2in}
    
\begin{proof}[Solution.]
We don't see anything that looks like this in Table 6.2.1.
So, we give up. NOT! We use some algebra, specifically {\em partial
fractions decomposition}.
\[
\frac{2s-3}{s^2-4} = \frac{2s-3}{(s-2)(s+2)} = \frac{A}{s-2} + \frac{B}{s+2}.
\]
We can solve for $A$ and $B$ by cross multiplying and getting two
equations in two unknowns, which can be solved for $A$ and $B$.
\[
2s-3 = A(s+2)+B(s-2) = (A+B)s + (2A-2B).
\]
Thus, $A+B=2$ and $A-B=-3/2$. We get $A=1/4$ and $B=7/4$.

Now we see that,
\[
L^{-1}\left(\frac{2s-3}{s^2-4}\right) = L^{-1}\left(\frac{1/4}{s-2} + \frac{7/4}{s+2}\right) = \tfrac{1}{4}\left(\frac{1}{s-2}\right) + \tfrac{7}{4}\left(\frac{1}{s+2}\right).
\]
Now we can use Table 6.2.1., or Example 3 above, to get
\[
L^{-1}(F(s)) =  \tfrac{1}{4}e^{2t} + \tfrac{7}{4}e^{-2t}.
\]
\end{proof}

\vspace{.2in}
    
%page 7
%\vfill\pagebreak


But, today is your lucky day! Many Computer Algebra
Systems have a command for this! Below, I did the last two examples
using Maple. First, I loaded a package called \red{\tt inttrans}, short for
{\em integral transforms}. We use the command \red{\tt invlaplace}.
%The format is \red{\tt invlaplace(F(s), s, t)}.
The output is in blue.

\vspace{.2in}

\noindent\red{\tt> with(inttrans);}

%\blue{[{\em addtable, fourier, fouriercos, fouriersin, hankel, hilbert, invfourier, invhilbert, invlaplace, invmellin, laplace, mellin, savetable}]}

\noindent\red{\tt> invlaplace(4/(s-1)$\wedge$3,s,t);}
  
\blue{$2t^2e^t$}

\noindent\red{\tt> invlaplace((2*s-3)/(s$\wedge$2-4),s,t);} 

\blue{$\frac{1}{4}e^{(2t)} + \frac{7}{4}e^{(-2t)}$}

  \vspace{.2in}
  
{\bf Example 8.}
Use the method of Laplace transforms to solve
\[
y''+3y'+2y=0, \:\: y(0)=1, \:\: y'(0)=0.
\]

\vspace{.2in}

\begin{proof}[Solution.]
  Apply the Laplace transform to both sides of the differential equation.
  \[
  s^2 L(y)-sy(0)-y'(0)+3(sL(y)-y(0))+2L(y) = L(0).
  \]
  Simplify, to get
  \[
  (s^2+3s+2)L(y)-s-3 = 0.
  \]
  Solving for $L(y)$ gives,
  \[
  L(y) = \frac{s+3}{s^2+3s+2}.
  \]
  Apply $L^{-1}$ to get
  \[
y = L^{-1}\left(\frac{s+3}{s^2+3s+2}\right)= L^{-1}\left(\frac{2}{s+1} -\frac{1}{s+2}\right) = 2e^{-t} - e^{-2t}.
  \]
\end{proof}  

%page 8
%\vfill\pagebreak

Note: The example we just did and Example 5 above can be done
far more easily using methods of Chapter 3. We are using these
examples here as toy problems to illustrate the new Laplace transform
method. Its real utility will be for problems with discontinuous
forcing functions.

Toward this end we now define the {\em Heaviside function}, also called the {\em unit step function}.
\[
u_c(t) = \left\{\begin{array}{ccc}0&\mbox{for}&t\leq c,\\1&\mbox{for}&t>c.\end{array}\right.
\]
See the graph below for $c=3$.
\begin{center}
\includegraphics[height=1.0in]{Figs/Heaviside1cropped.pdf}
\end{center}

%\vspace*{-1.7in}
Think of it as a switch. We use it to build a wide variety of discontinuous functions or functions
with ``kinks'' in them.

\vspace{.2in}

{\bf Example 9.} Let
\[
f(t) = \left\{\begin{array}{ccl}0&\mbox{for}&t\leq 0,\\2&\mbox{for}&0<t\leq2,\\1&\mbox{for}&3<t.\end{array}\right.
\]

\begin{center}
\includegraphics[height=1.5in]{Figs/Heaviside2cropped.pdf}
\end{center}

Then $f(t) = 2u_0(t)-u_3(t)$.

\vspace{.2in}

{\bf Example 10.} Let
\[
g(t) = \left\{\begin{array}{ccl}0&\mbox{for}&t\leq 0,\\\sin t&\mbox{for}&0<t\leq\pi,\\0&\mbox{for}&\pi<t.\end{array}\right.
\]

\begin{center}
\includegraphics[height=1in]{Figs/Heaviside3cropped.pdf}
\end{center}


Then $g(t) = (u_0(t) - u_\pi(t))\sin t$.

\vspace{.2in}

{\bf Example 11.} The graph of $y = h(t)$ is below. Write a formula
for $h(t)$ in terms of Heaviside functions.


\begin{center}
\includegraphics[height=1.4in]{Figs/Heaviside4cropped.pdf}
\end{center}


{\em Solution.} $h(t) = 2(u_0(t) - u_1(t)) + (t - 3)(u_3(t) - u_4(t))+(-t + 5)(u_4(t) - u_5(t)).$

\vspace{.2in}

Here are the computer commands I used in creating the last four
graphs.

%\begin{itemize}
{\small
 \noindent\red{\tt plot(Heaviside(t),t=-3..3,thickness=2,discont=true);}\\
 \red{\tt plot(2*Heaviside(t) - Heaviside(t-3),t=-7..7,thickness=2,discont=true);}\\
 \red{\tt plot(sin(t)*(Heaviside(t)-Heaviside(t-Pi)),t=-Pi..2*Pi,thickness=2,discont=true);}\\
 \red{\tt plot(2*(Heaviside(t) - Heaviside(t-1)) + (t-3)*(Heaviside(t-3)-Heaviside(t-4))}\\
\red{\tt + (-t+5)*(Heaviside(t-4)-Heaviside(t-5)) ,t=-2..7,thickness=2,discont=true);}
%\end{itemize}
}
  
Note: The option \red{\tt discont=true} suppresses vertical lines at the points of discontinuity.


%page 10
%\vfill\pagebreak

\vspace{.2in}

{\bf Fact.} (Table 6.2.1 item \#12.) $L(u_c(t)) = \frac{1}{s}e^{-cs}$, for $s>0$.


\begin{proof}
  \[
  \int_0^\infty e^{-st} u_c(t)\, dt = \int_c^\infty  e^{-st} \, dt = -\frac{1}{s}e^{-st}\big|_c^\infty =
  \]
  \[
  -\frac{1}{s}\left(\lim_{t\to\infty} e^{-st} -  e^{-cs}\right) = -\frac{1}{s}\left(0 -  e^{-cs}\right)= \frac{1}{s}e^{-cs},
  \]
  provided $s>0$.
\end{proof}


\vspace{.2in}

{\bf Fact.} (Table 6.2.1 item \#13.)
Let $f(t)$ be given and suppose $F(s) = L(f)$. Then
\[
L(u_c(t)f(t - c)) = e^{-cs}F(s).
\]

\begin{proof}
  \[
  \int_0^\infty e^{-st} u_c(t)f(t-c)\, dt = \int_c^\infty  e^{-st}f(t-c) \, dt = (*). 
  \]
  Substitute $r=t-c$. Then $dr = dt$ and $t=r+c$. Now,
  \[
(*) =  \int_0^\infty  e^{-s(r+c)}f(r) \, dr = e^{-cs} \int_0^\infty  e^{-sr}f(r) \, dr = e^{-cs}F(s).
  \]
\end{proof}


\vspace{.2in}

{\bf Fact.} (Table 6.2.1 item \#14.)
Let $f(t)$ be given and suppose $F(s) = L(f)$. Then
\[
L(e^{ct}f(t)) = F(s - c).
\]

\begin{proof}
  \[
L(e^{ct}f(t)) = \int_0^\infty e^{-st}e^{ct} f(t)\, dt =  \int_0^\infty e^{(c-s)t} f(t)\, dt= F(s-c).
  \]
\end{proof}



%page 11
%\vfill\pagebreak

Now we shall find the Laplace transforms for the functions defined
in Examples 9, 10 and 11.

\vspace{.2in}

Example 9.
\[
L(f(t)) = L(2u_0(t)-u_3(t)) = 2L(u_0(t))-L(u_3(t)) = \frac{2}{s} - \frac{e^{-3s}}{s},
\]
for $s > 0$.

\vspace{.2in}

Example 10.
\[
L(g(t)) = L((u_0(t)-u_\pi(t))\sin t) = L(u_0(t)\sin t - L(u_\pi(t)\sin(t+\pi-\pi)
\]
\[
= L(\sin t)- e^{-\pi s} L(\sin(t+\pi)) = L(\sin t)+ e^{-\pi s} L(\sin t) = \frac{1+ e^{-\pi s}}{1+s^2},
\]
for $s > 0$.

\vspace{.2in}

For Example 11 we will need to use that $L(t) = 1/s^2$, for $s > 0$.
You can compute this yourself or use Table 6.2.1 \#3.

{\tiny
    \begin{eqnarray*}  
  L(h(t)) &=& L (2(u_0(t) -  u_1(t)) + (t - 3)(u_3(t) - u_4(t)) + (-t + 5)(u_4(t) - u_5(t)))\\
  &&\\
  &=& 2/s - 2e^{-s}/s + L(u_3(t)(t - 3)) - L(u_4(t)(t + 1 - 4)) - L(u_4(t)(t - 1 - 4)) + L(u_5(t)(t - 5))\\
  &&\\
  &=& 2(1 - e^{-s})/s + e^{-3s}L(t) + e^{-5s}L(t) - L(u_4(t)(t + 1 - 4 + t - 1 - 4)\\
  &&\\
  &=& 2(1 - e^{-s})/s + (e^{-3s} + e^{-5s})/s^2 - L(u_4(t)(2t - 8))\\
  &&\\
  &=& 2(1 - e^{-s})/s + (e^{-3s} + e^{-5s})/s^2 - 2L(u_4(t)(t - 4))\\
  &&\\
  &=& 2(1 - e^{-s})/s + (e^{-3s} + e^{-5s})/s^2 - 2e^{-4s}L(t)\\
  &&\\
&=& 2(1 - e^{-s})/s + (e^{-3s} - 2e^{-4s} + e^{-5s})/s^2,
\end{eqnarray*}
}for $s > 0$.

%page 12
%\vfill\pagebreak
Now we put the pieces together to solve some nontrivial diff.~eqs.

\vspace{.2in}

{\bf Example 12.}
Solve $y''+y = f(t) = u_{10}(t)-u_{20}(t)$, with initial
condition $y(0) = y'(0) = 0$. The graph of $f(t)$ is below.

\begin{center}
\includegraphics[height=1.0in]{Figs/Example12inputcropped.pdf}
\end{center}



Imagine that this is a mass-string system initially at equilibrium and that a bird lands
on the mass causing a new downward force of 1 at $t = 10\pi$ and
that it jumps off at $t = 20\pi$. Here $u(t)$ is the downward displacement from equilibrium. 

\begin{proof}[Solution.]
We apply the Laplace transform and solve for $L(y)$.
\[
L(y'' + y) = L(f)
\]
\[
s^2L(y) - sy(0) - y'(0) + L(y) = \frac{e^{-10\pi} - e^{-20\pi}}{s}.
\]
\[
L(y) = \frac{e^{-10\pi} - e^{-20\pi}}{s(s^2+1)}.
\]
Now we apply the inverse Laplace transform.
\[
y = L^{-1}(L(y)) = L^{-1}\left( \frac{e^{-10\pi}}{s(s^2+1)}\right) - L^{-1}\left( \frac{e^{-20\pi}}{s(s^2+1)}\right).
\]
Let $G(s)= \frac{1}{s(s^2+1)}$ and let $g(t) = L^{-1}(G)$. Then by Table 6.2.1 \#13,
\[
 L^{-1}\left( \frac{e^{-10\pi}}{s(s^2+1)}\right) = u_{10\pi}(t) g(t-10\pi).
 \]
 We can find g(t) as follows.
 \[
 g(t) = L^{-1}\left(\frac{1}{s(s^2+1)}\right) = L^{-1}\left(\frac{1}{s}-\frac{1}{s^2+1}\right) =1-\cos t.
 \]
Of course, $\cos(t - 10\pi) = \cos t$. Thus,
\[
 L^{-1}\left( \frac{e^{-10\pi}}{s(s^2+1)}\right) = u_{10\pi}(t) (1-\cos t).
\]
Similarly,
\[
 L^{-1}\left( \frac{e^{-20\pi}}{s(s^2+1)}\right) = u_{20\pi}(t) (1-\cos t).
\]

%page 13
%\vfill\pagebreak

Putting it all together we have
\[
y(t) = (1 - \cos t)(u_{10\pi}(t)  - u_{20\pi}(t)).
\]
\end{proof}

Below is a graph of $y(t)$.
\begin{center}
\includegraphics[height=1.0in,width=4in]{Figs/Example12outputcropped.pdf}
\end{center}



{\bf Student Exercise.} Now, suppose we modify the problem so
that the external force $f(t)$ is turned off at $t = 19\pi$ instead of $20\pi$.
Show that the result is the graph below.
Write a paragraph explaining what happened.

\begin{center}
\includegraphics[height=2.0in,width=4in]{Figs/Example12StudentExercisecropped.pdf}
\end{center}



Experiment with different starting and cutoff times. See what happens.

%page 14
%\vfill\pagebreak

\vspace{.2in}

{\bf Example 13.} Solve $y'' + 3y' + 2y = f(t)$ with $y(0) = y'(0) = 0$,
where $f(t)$ is given by the graph below.

\begin{center}
\includegraphics[height=1in,width=4.0in]{Figs/Example13inputcropped.pdf}
\end{center}



\begin{proof}[Solution.]
We write f(t) using Heaviside functions.
\[f(t) = (t - 10)(u_{10}(t) - u_{20}(t)).\]
Next we apply the Laplace transform.
\[
L(y'' + 3y' + 3y) = (s^2 + 3s + 2)L(y),
\]
\[
L((t - 10)u_{10}(t)) = e^{-10s}L(t - 10 + 10) = e^{-10s} \frac{1}{s^2},
\]
and
\[
L((t - 10)u_{20}(t) = e^{-20s}L(t - 10 + 20) = e^{-20s}\left(\frac{1}{s^2} +\frac{10}{s}\right).
\]
Thus,
\[
L(f) = \frac{e^{-10s}}{s^2} - e^{-20s}\left(\frac{1}{s^2} +\frac{10}{s}\right)
\]
Therefore,
\[
L(y) =\frac{\frac{e^{-10s}}{s^2}- e^{-20s}\left(\frac{1}{s^2} +\frac{10}{s}\right)}{s^2+3s+2}.
\]

Next, we need to solve for y(t) by computing the inverse Laplace
transform.
\[
y = L^{-1}\left(\frac{e^{-10s}}{s^2(s+2)(s+1)} - \frac{e^{-20s}}{s^2(s+2)(s+1)} - \frac{10e^{-20s}}{s(s+2)(s+1)} \right).
\]

We will need to use two partial fraction expansions; you should check these.
\[
\frac{1}{s^2(s+2)(s+1)} = \frac{\tfrac{1}{2}}{s^2} - \frac{\tfrac{3}{4}}{s}- \frac{\frac{1}{4}}{s+2}+ \frac{1}{s+1},
\]
\[
\frac{1}{s(s+2)(s+1)} = \frac{\frac{1}{2}}{s} +\frac{\frac{1}{2}}{s+2} - \frac{1}{s+1}.
\]
Now we have,
\[
y(t) = L^{-1} \left(\frac{\tfrac{1}{2}e^{-10s}}{s^2} - \frac{\tfrac{3}{4}e^{-10s}}{s}- \frac{\frac{1}{4}e^{-10s}}{s+2}+ \frac{e^{-10s}}{s+1}\right) 
\]
\[
-L^{-1}\left(\frac{\tfrac{1}{2}e^{-20s}}{s^2} - \frac{\tfrac{3}{4}e^{-20s}}{s}- \frac{\frac{1}{4}e^{-20s}}{s+2}+ \frac{e^{-20s}}{s+1}\right)  
\]
\[
-L^{-1}\left( \frac{5e^{-20s}}{s}- \frac{5e^{-20s}}{s+2} - \frac{10e^{-20s}}{s+1}\right).
  \]

  After computing each of the eleven inverse Laplace transforms we
  get
  \[
  y(t) = \tfrac{1}{2}u_{10}(t)(t - 10) - \tfrac{3}{4}u_{10}(t) - \tfrac{1}{4}u_{10}(t)e^{-2t+20} + u_{10}(t)e^{-t+10}
  \]
  \[
- \tfrac{1}{2} u_{20}(t)(t - 20) + \tfrac{3}{4}u_{20}(t) +\tfrac{1}{4}u_{20}(t)e^{-2t+40} - u_{20}(t)e^{-t+20}
\]
\[
-5u_{20}(t) - 5u_{20}(t)e^{-2t+40} + 10u_{20}(t)e^{-t+20}.
\]

  Finally, we simplify in two steps.
  \[
y(t) = \left(\frac{t-10}{2} - \frac{3}{4}-\frac{e^{-2t+20}}{4}+e^{-t+10}\right) u_{10}(t)+
\]
\[
\left( -\frac{1}{2}(t - 20) +  \frac{3}{4} + \frac{e^{-2t+40}}{4} -e^{-t+20} -5 - 5e^{-2t+40}+10e^{-t+20}\right)u_{20}(t)\]
\[
= \tfrac{1}{4}\left(2t - 23 - e^{-2t+20}  + 4e^{-t+10}u10(t)\right) u_{10}(t) +
    \]
    \[
    \tfrac{1}{4}\left( 23 - 2t - 19e^{-2t+40} + 36e^{-t+20} \right)u_{20}(t).
  \]

\end{proof}




Here is a graph of the solution.

\begin{center}
\includegraphics[height=1in,width=4.0in]{Figs/Example13outputcropped.pdf}
\end{center}

{\bf Example 14.} We consider the RLC circuit shown below.

\begin{center}
\includegraphics[width=2.0in]{Figs/RLC.pdf}
\end{center}

Here $R$ is resistance, $L$ is inductance, $C$ is capacitance, and $E(t)$ is an external applied voltage.
Let $Q(t)$ be the current. Then recall that this circuit is governed by
\[
RQ'' + LQ' + Q/C = E(t).
\]
For this example we will use $L = 10$, $R = 1$ and $C = 0.2$. The external voltage
$E(t)$ is given by the graph below, where the hump is $\sin t$. We will
assume $Q(0) = Q'(0) = 0$. We will solve for $Q(t)$ and plot the result.
We will let the computer to most of the grunt work this time.

\begin{center}
\includegraphics[height=1.5in,width=4.0in]{Figs/Example14inputcropped.pdf}
\end{center}

%\vspace*{-5in}
We see that, $E(t) = \sin(t) (u_0(t) - u_\pi(t)) + 2(u_5(t) - u_6(t)).$

The solution is $Q(t) = L^{-1}\left( \frac{L(E(t))}{Ls^2 + Rs + 1/C}\right).$

Here are the Maple commands that were used to solve this problem. A graph of the solution is included. 

\vspace{.2in}
{\small
\noindent\red{\tt E := t -> sin(t)*(Heaviside(t)-Heaviside(t-Pi))+2*(Heaviside(t-5)-Heaviside(t-6));}\\
\red{\tt L:=10; R:=1; C:=0.2;}\\
\red{\tt Q := t -> invlaplace(laplace(E(t),t,s)/(L*s$\wedge$2+R*s+1/C),s,t);}\\
\red{\tt plot(Q(t),t=0..100,thickness=3,color=blue);}
}

\begin{center}
\includegraphics[height=2.0in,width=4.5in]{Figs/Example14outputcropped.pdf}
\end{center}

We now study periodic forcing functions.

\vspace{.2in}

{\bf Recall Geometric Series Formula.} For $|r|<1$ we have $$\sum_{n=0}^\infty r^n = \frac{1}{1-r}.$$ 

\vspace{.2in}

{\bf Theorem.} (Exercise \#28 in 6.3.) Let $f(t)$ be periodic with period
$T > 0$. (That is $f(t + T) = f(t)$.) Then
\[
L(f(t)) = \frac{\int_0^T e^{-st} f(t)\,dt}{1-e^{-sT}}.
\]
\begin{proof}
\[
L(f) =\int_0^\infty e^{-st} f(t)\, dt = \sum_{n=0}^\infty \int_{nT}^{(n+1)T} e^{-st} f(t)\, dt =
\]

\[
\sum_{n=0}^\infty \int_0^T e^{-s(t+nT)} f(t+nT)\, dt = \left(\sum_{n=0}^\infty e^{-snT}\right)\int_0^T  e^{-st} f(t)\, dt =(*).
\]
But,
\[
\sum_{n=0}^\infty e^{-snT} = \sum_{n=0}^\infty \left(e^{-sT}\right)^n = \frac{1}{1-e^{-sT}},
\]
since it is a geometric series and for $s > 0$ we have $e^{-sT} < 1$. Thus,
\[
(*)= \frac{\int_0^T e^{-st} f(t)\,dt}{1-e^{-sT}},
\]
as claimed.
\end{proof}


%\vfill\pagebreak
{\bf Example 15.} Solve $y'' + y = g(t)$, with $y(0) = y'(0) = 0$, where
$g(t)$ is the square wave shown below. Plot the solution.

\begin{center}
\includegraphics[height=1in,width=4.5in]{Figs/Example15inputcropped.pdf}
\end{center}




\begin{proof}[Solution]
Apply the Laplace transform to get
$s^2L(y) + L(y) = L(g)$. Thus,
\[
L(y) = \frac{L(g)}{s^2+1}.
\]
By the previous theorem
\[
L(g(t)) = \frac{\int_0^T e^{-st} g(t)\,dt}{1-e^{-sT}} =\frac{\int_0^1 e^{-st}\,dt}{1-e^{-sT}} =\frac{-\frac{1}{s}e^{-s}+\frac{1}{s}}{1-e^{-2s}} =\frac{1}{s(1+e^{-s})}.
\]
Therefore,
\[
y = L^{-1}\left( \frac{1}{s(s^2+1)} \cdot \frac{1}{1+e^{-s}} \right).
\]
Let $F(s)=\frac{1}{s(s^2+1)}$ and let $f(t)= L^{-1}(F(s))$. Then,
\[
f(t)=L^{-1}\left( \frac{1}{s(s^2+1)}\right) = L^{-1}\left(\frac{1}{s} - \frac{s}{s^2+1} \right) =1 - \cos t.
\]

Since, $s > 0$ we have $e^{-s} < 1$. Then the formula for a convergent
geometric series gives us
\[
\frac{1}{1-(-e^{-s})} = \sum_{n=0}^\infty (-1)^n e^{-ns}.
\]
Table 6.2.1 item \#13 says
\[
L^{-1} \left(e^{-ns}F(s)\right) = u_n(t)f(t - n).
\]
Therefore,
\[
y(t) = \sum_{n=0}^\infty (-1)^n u_n(t)(1 - \cos(t - n)).
\]

\end{proof}

Below is a plot of $y(t)$ for $0 \leq t \leq 50$.

\begin{center}
\includegraphics[height=1in,width=4.5in]{Figs/Example15outputcropped.pdf}
\end{center}


{\bf Student Exercise.} Play! That is experiment with different periods for
the square wave and see what happens. Do some periods produce
a stronger response than others? 



\end{document}
