%%%%		-*- Mode: LaTeX -*-
%%%% Author:    J. Robert Buchanan
%%%% Address:   Department of Mathematics
%%%%		Millersville University
%%%%            P.O. Box 1002
%%%%            Millersville, PA 17551-0302
%%%% Phone:     717-871-7305
%%%% FAX:	717-871-7948
%%%%
%%%% Email:     Robert.Buchanan@millersville.edu
%%%%
%%%% Date:      04/03/2025
%%%%
%%%% Purpose:   Discretization of Derivatives
%%%%

\documentclass[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{Discretization of Derivatives}
\subtitle{\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{Objectives}

In this lesson we will:
\begin{itemize}
\item review Taylor's theorem,
\item develop forward, backward, and centered difference formulas for
  the first derivative, and
\item develop the midpoint formula for the second derivative.
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Discretization}

\begin{itemize}
\item Finite difference methods replace the $xt$-plane with a
regularly spaced grid of points. as illustrated in
\item This collection of regularly spaced points is often referred to as a
\textbf{discretization} of the plane.
\item The horizontal spacing of the points is denoted as $h$ while the vertical
spacing is denoted as $k$.
\item A particular point in the discrete plane will be located by its
coordinates $(i \, h, j \, k)$ where $i$ and $j \in \mathbb{Z}$.
\item If $u$ is a real-valued function of $(x, t)$ then the approximation of
this function at the point with coordinates $(i \, h, j \, k)$ will be
compactly denoted as $u_{i}^{j}$.
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Illustration}

\begin{center}
\resizebox{1.00\textwidth}{!}{\includegraphics{grid}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Taylor's Theorem}

The solution of an ordinary or partial differential equation by the finite
difference method is a matter of developing formulas to approximate
the derivatives or partial derivatives of functions at the discrete
grids of points described above.
The underlying mechanism which makes these approximations possible is
\textbf{Taylor's theorem}.
\begin{theorem}
%\label{thm:findiff:Taylor}
If function $f$ is $n+1$ times continuously differentiable on $(a, b)$
and if $a < x_{0} < b$ then for any $x \in (a, b)$,
\begin{align*}
%\label{eq:findiff:Taylor}
f(x)
	= {} & f(x_{0}) + f'(x_{0}) (x - x_{0}) + \cdots +
\frac{f^{(n)}(x_{0})}{n!} (x-x_{0})^{n}	\\
	&+ \frac{f^{(n+1)}(z)}{(n+1)!} (x-x_{0})^{n+1}
\end{align*}
where $z$ lies between $x_{0}$ and $x$.
\end{theorem}

\end{frame}
%%

\begin{frame}\frametitle{Taylor Polynomial and Remainder}

The expression
\[
%\label{eq:findiff:Taylorpoly}
P_{n}(x)
	= f(x_{0}) + f'(x_{0}) (x - x_{0}) + \cdots + \frac{f^{(n)}(x_{0})}{n!} (x-x_{0})^{n}
\]
is called the
\textbf{$n$th Taylor polynomial
approximation} of $f(x)$
centered at $x_{0}$ and
\[
%\label{eq:findiff:Taylorremainder}
R_{n}(x)
	= \frac{f^{(n+1)}(z)}{(n+1)!} (x-x_{0})^{n+1}
\]
is called the \textbf{$n$th Taylor
remainder}.

\vspace*{0.10in}

If there exists a constant $M_{n}$ such that
\[
\max_{a \le z \le b} \left| \frac{f^{(n+1)}(z)}{(n+1)!} \right|
	\le M_{n}	,
\]
then the absolute
error in approximating $f(x)$ on interval $(a, b)$
by $P_{n}(x)$ is bounded by
$E_{n}(x) = M_{n} |x-x_{0}|^{n+1}$.

\end{frame}
%%

\begin{frame}\frametitle{Forward and Backward Difference}
\fontsize{9pt}{10.8}\selectfont

Suppose $U(x)$ is twice continuously differentiable on an open
interval containing $x_{0}$, then
\[
U(x_{0}+h)
	= U(x_{0}) + U'(x_{0}) h + U''(z) \frac{h^{2}}{2!}
\]
where $z$ lies between $x_{0}$ and $x_{0}+h$.
Rearranging terms yields the
equation
\[
U'(x_{0})
	= \frac{U(x_{0}+h) - U(x_{0})}{h} - U''(z) \frac{h}{2!}	.
\]
When $h > 0$ this produces the
\textbf{forward difference} approximation to
$U'(x_{0})$ or equivalently,
\[
%\label {eq:findiff:forward}
U'(x_{0})
	\approx \frac{U(x_{0}+h) - U(x_{0})}{h}	.
\]
If $h < 0$, this is called the
\textbf{backward difference} approximation to
$U'(x_{0})$.
The error term $U''(z) h/2!$ is described as being $O(h)$ (pronounced
``big oh of $h$'') as $h \to 0$.
Since $U(x)$ is assumed to be twice continuously differentiable near
$x_{0}$, when $h$ is sufficiently small,
\[
\left| \frac{U''(z)}{2!} h \right|
	\le M \left| h \right|	,
\]
where $M$ is a positive constant.

\end{frame}
%%

\begin{frame}\frametitle{Centered Difference}

If $U(x)$ is three times times continuously differentiable on
$(a, b)$ and $a < x_{0} < b$ then
\[
U'(x_{0})
	= \frac{U(x_{0} + h) - U(x_{0} - h)}{2h} + U'''(v) \frac{h^{2}}{3!}	,
\]
for some $a < v < b$.

\vspace*{0.10in}

The approximation
\[
%\label{eq:findiff:centered}
U'(x_{0})
	\approx \frac{U(x_{0} + h) - U(x_{0} - h)}{2h}
\]
is known as the \textbf{centered difference
formula} and has an error term
which is $O(h^{2})$.

\end{frame}
%%

\begin{frame}\frametitle{Second Derivative}

Suppose $U(x)$ is four times times continuously differentiable on
$(a, b)$ and $a < x_{0} < b$, then
\[
U''(x_{0})
	= \frac{U(x_{0} + h) - 2 U(x_{0}) + U(x_{0} - h)}{h^{2}} +
U^{(4)}(v) \frac{h^{2}}{12}
\]
for some $a < v < b$.

\vspace*{0.10in}

The approximation
\[
%\label{eq:findiff:secderiv}
U''(x_{0})
	\approx \frac{U(x_{0} + h) - 2 U(x_{0}) + U(x_{0} - h)}{h^{2}}
\]
is known as the \textbf{second derivative midpoint
  formula} and has an error term
which is $O(h^{2})$.

\end{frame}
%%

\begin{frame}\frametitle{Application: Heat Equation}

If $u$ is a function of $(x, t)$ the discrete approximation
to the homogeneous heat equation
\[
u_{t}
	= u_{xx}
\]
can be expressed using the forward difference formula in $t$ and the second
derivative midpoint formula in $x$ as
\[
%\label{eq:findiff:explicitheat}
\frac{u(x, t+k) - u(x, t)}{k}
	\approx \frac{u(x+h, t) - 2 u(x, t) + u(x-h, t)}{h^{2}}	.
\]

\end{frame}
%%

%\begin{frame}\frametitle{Homework}

%\begin{itemize}
%\item Read Section $x.y$
%\item Exercises: 
%\end{itemize}

%\end{frame}
%%

%%%
\end{document}

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