%%%%		-*- Mode: LaTeX -*-
%%%% Author:    J. Robert Buchanan
%%%% Address:   Department of Mathematics
%%%%		Millersville University
%%%%            P.O. Box 1002
%%%%            Millersville, PA 17551-0302
%%%% Phone:     717-872-3659
%%%% FAX:	717-871-2320
%%%% Email:     Robert.Buchanan@millersville.edu
%%%%
%%%% Date:      06/30/2022
%%%%
%%%% Purpose:   The Gibbs Phenomenon
%%%%

\documentclass[handout,10pt]{beamer}

\mode<presentation>
{
  %\usetheme{Warsaw}
  \usetheme{default}
  %\usetheme{CambridgeUS}
  % or ...

  %\setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}


\usepackage[english]{babel}
% or whatever

\usepackage[latin1]{inputenc}
% or whatever

\usepackage{times}
\usepackage[T1]{fontenc}
% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.


\title{The Gibbs Phenomenon}
\subtitle{MATH 365 \textit{Partial Differential Equations}} % (optional)


\author % (optional, use only with lots of authors)
{J~Robert~Buchanan}
% - Use the \inst{?} command only if the authors have different
%   affiliation.

\institute[Millersville University of Pennsylvania]
% (optional, but mostly needed)
{
  Department of Mathematics
}
% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.

\date{ % (optional)
Fall
%Spring
%Summer
\the\year}

\subject{Talks}
% This is only inserted into the PDF information catalog. Can be left
% out. 



% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

% \pgfdeclareimage[height=0.5cm]{university-logo}{university-logo-filename}
% \logo{\pgfuseimage{university-logo}}



% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
\AtBeginSubsection[]
{
  \begin{frame}<beamer>
    \frametitle{Outline}
    \tableofcontents[currentsection,currentsubsection]
  \end{frame}
}


% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command: 

%\beamerdefaultoverlayspecification{<+->}


\begin{document}

\begin{frame}
  \titlepage
\end{frame}

%\begin{frame}
%  \frametitle{Outline}
%  \tableofcontents
  % You might wish to add the option [pausesections]
%\end{frame}


% Since this a solution template for a generic talk, very little can
% be said about how it should be structured. However, the talk length
% of between 15min and 45min and the theme suggest that you stick to
% the following rules:  

% - Exactly two or three sections (other than the summary).
% - At *most* three subsections per section.
% - Talk about 30s to 2min per frame. So there should be between about
%   15 and 30 frames, all told.

%\section{Introduction}

\begin{frame}\frametitle{Periodic Function with Discontinuity}

Let
\[
f(x) = \left\{
\begin{array}{rl}
\displaystyle -\frac{1}{2} (\pi + x) & \mbox{if $-\pi \le x < 0$,}	\\
\displaystyle \frac{1}{2} (\pi - x) & \mbox{if $0 \le x < \pi$.}
\end{array}
\right.
\]
Let $F(x)$ be the $2 \pi$-periodic extension of $f(x)$ to
$\mathbb{R}$.
\begin{center}
\scalebox{0.80}{\includegraphics{f2pi}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Fourier Series}

Since $F(x)$ is an odd function we can represent it by a
\textbf{Fourier Sine Series}.
\[
F(x) \sim \sum_{n=1}^{\infty} b_{n} \sin (n x)
\]
where
\[
b_{n} = \frac{2}{\pi} \int_{0}^{\pi} \frac{1}{2} ( \pi - x ) \sin (n
x) \, dx = \frac{1}{n}
\]
for $n = 1, 2, \ldots$.

\uncover<2->{%
\[
F(x) \sim \sum_{n=1}^{\infty} \frac{1}{n} \sin (n x)
\]
}

\end{frame}
%%

\begin{frame}\frametitle{Partial Sums}

Let
\[
S_{N}(x) = \sum_{n=1}^{N} \frac{1}{n} \sin (n x)
\]
and consider the convergence of $S_{N}(x)$ to $F(x)$.
\begin{center}
\scalebox{1.0}{\includegraphics{sN}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Zoom In Near $x = 0$}

\begin{center}
\scalebox{1.0}{\includegraphics{nonuniform}}
\end{center}
It appears that there is a non-decreasing deviation of $S_{N}(x)$ from
$F(x)$ for $x$ near $0$ even as $N \to \infty$.

\end{frame}
%%

\begin{frame}\frametitle{Deviation}

Let $x = \pi/(N+1)$ then
\[
S_{N}\left( \frac{\pi}{N+1} \right) =
\sum_{n=1}^{N} \frac{1}{n} \sin \frac{n \pi}{N+1}	.
\]

\textbf{Remark:} this expression can be interpreted as a Riemann sum
approximation to $\displaystyle \int_{0}^{\pi} \frac{\sin x}{x} \, dx$.

\uncover<2->{%
Let
\begin{align*}
\Delta x &= \frac{\pi}{N+1}	\\
x_{n}	&= \frac{n \pi}{N+1}
\quad\mbox{for $n = 0, 1, \ldots, N+1$}	\\
w_{n}	&= \frac{n \pi}{N+1}
\quad\mbox{for $n = 1, 2, \ldots, N+1$.}
\end{align*}
}

\end{frame}
%%

\begin{frame}\frametitle{Riemann Sum}

\begin{align*}
\int_{0}^{\pi} \frac{\sin x}{x} \, dx
	&\approx \sum_{n=1}^{N+1} \frac{\sin w_{n}}{w_{n}} \Delta x	\\
	&= \sum_{n=1}^{N+1} \frac{\sin \frac{n \pi}{N+1}}{\frac{n \pi}{N+1}}
\frac{\pi}{N+1}	\\
	&= \sum_{n=1}^{N+1} \frac{1}{n} \sin \frac{n \pi}{N+1}	\\
	&= \sum_{n=1}^{N} \frac{1}{n} \sin \frac{n \pi}{N+1}	,
\end{align*}
since $\displaystyle \sin \frac{(N+1) \pi}{N+1} = 0$.
Thus
\[
\int_{0}^{\pi} \frac{\sin x}{x} \, dx \approx S_{N}\left(
\frac{\pi}{N+1} \right)	.
\]

\end{frame}
%%

\begin{frame}\frametitle{Limit}

Since
\[
\int_{0}^{\pi} \frac{\sin x}{x} \, dx \approx S_{N}\left(
\frac{\pi}{N+1} \right)	,
\]
then
\[
\lim_{N \to \infty} S_{N}\left( \frac{\pi}{N+1} \right)
	=
\int_{0}^{\pi} \frac{\sin x}{x} \, dx	.
\]
We need to evaluate the definite integral.

\uncover<2->{%
Recall the Taylor series for $\sin x$.
\[
\sin x = \sum_{k=0}^{\infty} \frac{(-1)^{k} x^{2k+1}}{(2k+1)!}
\quad\Longrightarrow\quad
\frac{\sin x}{x} = \sum_{k=0}^{\infty} \frac{(-1)^{k} x^{2k}}{(2k+1)!}
\]
}

\end{frame}
%%

\begin{frame}\frametitle{Definite Integral}

\begin{align*}
\int_{0}^{\pi} \frac{\sin x}{x} \, dx
	&=
\int_{0}^{\pi} \sum_{k=0}^{\infty} \frac{(-1)^{k} x^{2k}}{(2k+1)!} \,
dx	\\
	&=
\sum_{k=0}^{\infty} \frac{(-1)^{k}}{(2k+1)!} \int_{0}^{\pi}
x^{2 k} \, dx	\\
	&=
\sum_{k=0}^{\infty} \frac{(-1)^{k} \pi^{2k+1}}{(2k+1)(2k+1)!}
\end{align*}

\textbf{Remark:}
The definite integral is expressed as an alternating series.
We can use the Alternating Series Test to confirm its convergence and
to estimate the value of the definite integral.

\end{frame}
%%

\begin{frame}\frametitle{Alternating Series Test}

\begin{theorem}[Alternating Series Test]
The alternating series $\displaystyle \sum_{k=1}^{\infty} (-1)^{k+1}
a_{k}$ is convergent if
\begin{enumerate}
\item $0 < a_{k+1} \le a_{k}$ for all $k \ge 1$, and
\item $\displaystyle \lim_{k \to \infty} a_{k} = 0$.
\end{enumerate}
\end{theorem}

\begin{theorem}
Suppose $\displaystyle \sum_{k=1}^{\infty} (-1)^{k+1}
a_{k}$ is a convergent alternating series.
If $S$ is the sum of the series and $S_{n}$ is the $n^{th}$ partial
sum of the series, then
\[
| S - S_{n} | \le a_{n+1}
\]
for all $n$.
\end{theorem}

\end{frame}
%%

\begin{frame}\frametitle{Estimation of the Definite Integral}

Let $\displaystyle S = \int_{0}^{\pi} \frac{\sin x}{x} \, dx$ then
\[
S \approx T_{M} =
\sum_{k=0}^{M} \frac{(-1)^{k} \pi^{2k+1}}{(2k+1)(2k+1)!}
\]
and
\[
\left| S - T_{M} \right|
	\le
\left| \frac{(-1)^{M+1} \pi^{2M+3}}{(2M+3)(2M+3)!} \right|
	=
\frac{\pi^{2M+3}}{(2M+3)(2M+3)!}	.
\]
When $M=15$ we have
\[
\left| S - T_{M} \right| \le \frac{\pi^{33}}{(33)33!} \approx 8.88682
\times 10^{-23}	,
\]
thus
\[
S \approx T_{15} \approx 1.85194	.
\]

\end{frame}
%%

\begin{frame}\frametitle{Deviation Revisited (1 of 2)}

\begin{center}
\scalebox{1.0}{\includegraphics{nonuniform}}
\end{center}
\[
F\left( \frac{\pi}{N+1} \right) - S_{N} \left( \frac{\pi}{N+1} \right)
	=
\frac{N \pi}{2 (N+1)} - \sum_{n=1}^{N} \frac{1}{n} \sin \frac{n \pi}{N+1}
\]

\end{frame}
%%

\begin{frame}\frametitle{Deviation Revisited (2 of 2)}

\begin{align*}
\lefteqn{\lim_{N \to \infty} \left|
F\left( \frac{\pi}{N+1} \right) - S_{N} \left( \frac{\pi}{N+1} \right)
\right|}	\\
	&= \left|
\lim_{N \to \infty}
\left(
\frac{N \pi}{2 (N+1)} - \sum_{n=1}^{N} \frac{1}{n} \sin \frac{n \pi}{N+1}
\right)
\right|	\\
	&= \left|
\frac{\pi}{2} - \int_{0}^{\pi} \frac{\sin x}{x} \, dx
\right|	\\
	&\approx \left| \frac{\pi}{2} - 1.85194 \right|	\\
	&\approx 0.281141
\end{align*}
Thus there is always a deviation of at least $0.28$ for all $N$ even
as $N \to \infty$.

\end{frame}
%%

%%%
\end{document}

%%%%
%%%% EOF
%%%%
