%%%%		-*- 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:      02/11/2025
%%%%
%%%% Purpose:   Applications of First-Order PDEs
%%%%

\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{Applications of First-Order PDEs}
\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 apply the solution techniques learned earlier
to finding the solutions to some first-order PDEs arising in the
natural and physical sciences.

\end{frame}
%%

\begin{frame}\frametitle{Structured Population Growth}

\begin{itemize}
\item
Consider a population consisting of individuals of different ages or
sizes $x$ at time $t$.
\item
Define $p(x, t)$ to be age-density of the population.
The number of individuals in the population between ages $x$ and $x +
\Delta x$ at time $t$ is approximately
\[
p(x, t) \, \Delta x	.
\]
\item
Define $N(t)$ to be the total population at time $t$,
\[
N(t) = \int_{0}^{\infty} p(x, t) \, dx	.
\]
\end{itemize}
We wish to develop a PDE model for the evolution of the age-density.

\end{frame}
%%

\begin{frame}\frametitle{Calendar Time and Age}

\begin{itemize}
\item Population with ages in $[x, x+\Delta x]$ at time $t+\Delta t$ is
  approximately $p(x, t+\Delta t) \, \Delta x$.
\item If individuals age at the same rate as time passes then
\[
p(x, t+\Delta t) \, \Delta x = p(x-\Delta t, t) \, \Delta x 
\]
in other words, if deaths are ignored the number of individuals with
ages $[x, x+\Delta x]$ at time $t+\Delta t$ is the same as the number of
individuals with ages $[x-\Delta t, x]$ at time $t$.
\item Let $\mu(x)$ the rate of death (deaths per unit time) of
  individuals of age $x$.
The number of deaths in the population of individuals with ages
$[x-\Delta t, x]$ between times $t$ and $t+\Delta t$ is approximately
\[
\mu(x-\Delta t) p(x-\Delta t, t) \, \Delta x \, \Delta t	.
\]
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Population Equation}
\fontsize{9pt}{10.8}\selectfont

\begin{align*}
p(x, t+\Delta t) \, \Delta x
	&\approx p(x-\Delta t, t) \, \Delta x - \mu(x-\Delta t) p(x-\Delta t, t) \,
                    \Delta x \, \Delta t	\\
p(x, t+\Delta t) - p(x-\Delta t, t)
	&\approx -\mu(x-\Delta t) p(x-\Delta t, t) \, \Delta t
\end{align*}
Add and subtract $p(x, t)$ on the left-hand side of the approximation.
\begin{align*}
p(x, t+\Delta t) - p(x, t) + p(x, t) - p(x-\Delta t, t)
	&\approx -\mu(x-\Delta t) p(x-\Delta t, t) \, \Delta t	\\
\frac{p(x, t+\Delta t) - p(x, t)}{\Delta t} + \frac{p(x, t) - p(x-\Delta t, t)}{\Delta t}
	&\approx -\mu(x-\Delta t) p(x-\Delta t, t)	\\
p_{t} + p_{x} &= -\mu(x) \, p
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{von Foerster Equation}

We have the first-order linear PDE
\[
p_{t} + p_{x} = -\mu(x) \, p
\]
with side condition
\[
p(x, 0) = f(x)	,
\]
specifying the initial distribution of the ages within the population, and
\[
p(0, t) = \phi(t)
\]
the density of new births at time $t$.

\end{frame}
%%

\begin{frame}\frametitle{Solution (1 of 2)}

\begin{itemize}
\item
Using the method of characteristics,
\[
\frac{dx}{dt} = 1
\implies
x - t = k
\]
where $k$ is a constant.
\item
Assuming $p(x, t) = p(x(t), t) = p(t)$ then
\[
\frac{dp}{dt} = p_{t} + p_{x} \frac{dx}{dt} = p_{t} + p_{x} = -\mu(x)
\, p = -\mu(t+k) p	.
\]
\item
Solving this first-order linear ODE yields,
\[
p(t) = C(k) e^{-\int_{t_{0}}^{t} \mu(s+k) \, ds}	.
\]
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Characteristics}

\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{characteristics}}
\end{center}
\[
p(t) = C(k) e^{-\int_{t_{0}}^{t} \mu(s+k) \, ds}	.
\]
Function $p(t)$ is defined for $t \ge 0$ when $k \ge 0$ and is defined
for $t \ge -k$ when $k < 0$.

\end{frame}
%%

\begin{frame}\frametitle{Solution (2 of 2)}

Apply side conditions.
\[
p(0) = C(k) = \left\{ \begin{array}{rl}
f(k) & \mbox{if $k \ge 0$,}	\\
\phi(-k) & \mbox{if $k < 0$.}
\end{array} \right.
\]

Thus the solution can be expressed as
\begin{align*}
p(x, t)
	&=
\left\{ \begin{array}{rl}
f(x-t) e^{\int_{0}^{t} \mu(s+x-t) \, ds} & \mbox{if $k \ge 0$,}	\\
\phi(t-x) e^{-\int_{-k}^{t} \mu(s+x-t) \, ds} & \mbox{if $k < 0$.}
\end{array} \right.	\\
	&=
\left\{ \begin{array}{rl}
f(x-t) e^{-\int_{x-t}^{x} \mu(s) \, ds} & \mbox{if $t < x$,} \\
\phi(t-x) e^{-\int_{0}^{x} \mu(s) \, dx} & \mbox{if $t > x$.}
\end{array} \right.
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{Example}

\begin{align*}
\phi(t)	&= \frac{e^{-25/8}}{\sqrt{2 \pi}} + \frac{1}{2} (1 - e^{-t})	\\
f(x)	&= \frac{1}{\sqrt{2 \pi}} e^{-(x-5/2)^{2}/2}	\\
\mu(x)	&= 1 - e^{-x/5}
\end{align*}
\begin{center}
\resizebox{0.70\textwidth}{!}{\includegraphics{example01}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Comments}

A reasonable assumption is that new births at time $t$ depend on the
distribution of ages in the population and/or the total population.

\vspace*{0.10in}

If the birth rate is age-dependent denote it as $\beta(x)$ and then,
\[
p(0, t) = \int_{0}^{\infty} \beta(x) p(x, t) \, dx	.
\]
This is called as \textbf{nonlocal boundary condition} since $p(0, t)$
depends on the unknown density $p(x, t)$.

\end{frame}
%%

\begin{frame}\frametitle{Nonlocal Boundary Condition}

\begin{align*}
\phi(t)
	&= p(0, t)
	= \int_{0}^{\infty} \beta(x) p(x, t) \, dx  \\
	&= \int_{0}^{t} \beta(x) p(x, t) \, dx + \int_{t}^{\infty} \beta(x) p(x, t) \, dx  \\
	&= \int_{0}^{t} \beta(x) \phi(t - x) e^{-\int_{0}^{x} \mu(s) \, ds} \, dx	+
\int_{t}^{\infty} \beta(x) f(x - t) e^{-\int_{x-t}^{x} \mu(s) \, ds} \, dx
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{Volterra Integral Equation}

Define $\displaystyle
\psi(t) = \int_{t}^{\infty} \beta(x) f(x - t) e^{-\int_{x-t}^{x}
  \mu(s) \, ds} \, dx$, then
\[
\phi(t)
	=
\int_{0}^{t} \beta(x) \phi(t - x) e^{-\int_{0}^{x} \mu(s) \, ds} \, dx
+ \psi(t)
\]
which is an example of a \textbf{Volterra integral equation}.

\vspace*{0.10in}

If the integral equation can be solved for $\phi(t)$ then, as before,
\[
p(x, t)
	=
\left\{ \begin{array}{rl}
f(x-t) e^{-\int_{x-t}^{x} \mu(s) \, ds} & \mbox{if $t < x$,} \\
\phi(t-x) e^{-\int_{0}^{x} \mu(s) \, dx} & \mbox{if $t > x$.}
\end{array} \right.
\]

\end{frame}
%%

\begin{frame}\frametitle{Traffic Flow}

Consider a one-way, single lane road and the vehicles on it.
\begin{itemize}
\item Vehicles are not allowed to pass each other.
\item The road has no exits or entrances.
All vehicles on the road are already present.
No additional vehicles will be added and none may leave.
\item Function $\rho(x, t)$ denotes the density of vehicles, the number
of vehicles per unit length of road (for example, cars/mile) at time
$t$ at the location $x$.
\item Function $q(x, t)$ denotes the flow of traffic, the number of
  vehicles passing location $x$ and at time $t$.
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Model Development (1 of 3)}

In consider the interval $[a, b]$ along the road.
The total number of vehicles in interval $[a, b]$ given by
\[
N(t) = \int_{a}^{b} \rho(x, t) \, dx	.
\]
The time rate of change of $N(t)$ is
\[
\frac{dN}{dt} =
\frac{d}{dt} \left[ \int_{a}^{b} \rho(x, t) \, dx \right] =
q(a, t) - q(b, t)	.
\]
\textbf{Question}: what is an intuitive interpretation of the last equation?

\end{frame}
%%

\begin{frame}\frametitle{Model Development (2 of 3)}

\begin{align*}
q(a, t) - q(b, t)
	&=
-\int_{a}^{b} \frac{\partial}{\partial x} \left[ q(x, t) \right] \, dx
  \\
	&=
\frac{d}{dt} \left[ \int_{a}^{b} \rho(x, t) \, dx \right]
\end{align*}
Equating the right-hand sides and re-arranging terms produces:
\[
\int_{a}^{b} \left( \frac{\partial}{\partial t} \left[ \rho(x, t)
  \right] +
\frac{\partial}{\partial x} \left[ q(x, t) \right] \right) \, dx = 0	,
\]
which implies (since $[a, b]$ is arbitrary),
\[
\rho_{t} + q_{x}  = 0	.
\]

\end{frame}
%%

\begin{frame}\frametitle{Model Development (3 of 3)}

The PDE:
\[
\rho_{t} + q_{x}  = 0
\]
contains 2 unknown functions.
If we assume $q(x, t) = \rho(x, t) u(\rho(x, t))$ where $u$ is the
velocity function for a vehicle, then we have
\[
\rho_{t} + (\rho \, u)_{x} = 0
\]
which contains only the unknown traffic density.

\vspace*{0.10in}

\uncover<2->{%
A common choice for $u$ is
\[
u = u_{\max} \left( 1 - \frac{\rho(x, t)}{\rho_{\max}} \right)	.
\]
}

\end{frame}
%%

\begin{frame}\frametitle{Vehicle Speed \textit{vs}. Density}

\[
u = u_{\max} \left( 1 - \frac{\rho(x, t)}{\rho_{\max}} \right)	.
\]
\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{speedvsrho}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Quasilinear PDE}

Using the common choice for $u$ then
\begin{align*}
\rho_{t} + (\rho \, u)_{x} &= 0	\\
\rho_{t} + u_{\max} \left[ \rho \left( 1 - \frac{\rho}{\rho_{\max}}
  \right) \right]_{x} &= 0	\\
\rho_{t} + u_{\max} \left( 1 - \frac{2 \rho}{\rho_{\max}} \right) \rho_{x} &= 0	,
\end{align*}
which is a first-order quasilinear PDE.

\vspace*{0.10in}

We can solve this PDE with side condition $\rho(x,0) = f(x)$.

\end{frame}
%%

\begin{frame}\frametitle{Characteristic System}

\begin{align*}
\frac{dt}{d\tau} &= 1
\uncover<2->{%
\implies
t(\tau) = \tau + A}
	\\
\frac{dx}{d\tau} &= u_{\max} \left( 1 - \frac{2 \rho}{\rho_{\max}}
                       \right)
\uncover<4->{%
\implies
x(\tau) = 
u_{\max} \left( 1 - \frac{2 B}{\rho_{\max}} \right) \tau + C
}
	\\
\frac{d\rho}{d\tau}	&= 0
\uncover<3->{%
\implies
\rho(\tau) = B
}
\end{align*}
\uncover<4->{%
where $A$, $B$, and $C$ are constants.
}

\end{frame}
%%

\begin{frame}\frametitle{Characteristic Curves}

\begin{itemize}
\item The initial density defined a non-characteristic curve
$(0, s, f(s))$.
\item Suppose the characteristics intersect this curve at $\tau = 0$.
\end{itemize}

\begin{align*}
t(0) &= 0 = A	\\
x(0) &= s = C	\\
\rho(0) &= f(s) = B
\end{align*}
which implies
\begin{align*}
t &= \tau	\\
x &=
u_{\max} \left( 1 - \frac{2 f(s)}{\rho_{\max}} \right) \tau + s	\\
\rho &= f(s)	.
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{Elimination of $\tau$}

Since $t = \tau$,
\begin{align*}
x &= u_{\max} \left( 1 - \frac{2 f(s)}{\rho_{\max}} \right) t + s	\\
\rho &= f(s)	.
\end{align*}

Consider the characteristics in the $xt$-plane.
\begin{itemize}
\item The characteristics are straight lines.
\item The $x$-intercept lies at $(s,0)$.
\item The density of vehicles is constant (with value $f(s)$) along
  this characteristic.
\item If $f(s) = f_{0}$ a constant, then all characteristics are parallel.
\end{itemize}

\uncover<2->{%
\textbf{Question}: what if $f(s)$ is not constant?
}

\end{frame}
%%

\begin{frame}\frametitle{Case: $f'(s) < 0$}

If $f(s)$ is decreasing then characteristics do not intersect for $t \ge 0$.
\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{decreasingf}}
\end{center}
The density of vehicles is well-defined for $t \ge 0$.

\end{frame}
%%

\begin{frame}\frametitle{Case: $f'(s) < 0$}

\begin{center}
\resizebox{0.70\textwidth}{!}{\includegraphics{fandensity}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Case: $f'(s) > 0$}

If $f(s)$ is increasing then characteristics intersect for some $t \ge 0$.
\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{increasingf}}
\end{center}
This implies the density takes on two different values.
This phenomenon is known as a \textbf{shock}.

\end{frame}
%%

\begin{frame}\frametitle{Case: $f'(s) > 0$}

\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{shocksurf}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Case: $f'(s) > 0$}

\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{shockback}}
\end{center}
\textbf{Question}: when does the shock occur?

\end{frame}
%%

\begin{frame}\frametitle{Time of Shock (1 of 2)}

\begin{itemize}
\item The shock occurs at the earliest time for which there is a vertical
tangent line to the integral surface.
\item<2-> Suppose the shock occurs at $t = t_{0}$, then
\begin{align*}
x(s) &= u_{\max} \left( 1 - \frac{2 f(s)}{\rho_{\max}} \right) t_{0} + s	\\
\rho(s) &= f(s)	.
\end{align*}
We must find the tangent vector to this parametrically defined curve.
\item<3-> Using the chain rule for derivatives,
\[
\frac{d\rho}{dx} = \frac{d\rho/ds}{dx/ds} = \frac{f'(s)}{1 - \frac{2
    u_{\max} t_{0}}{\rho_{\max}} f'(s)}	.
\]
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Time of Shock (2 of 2)}

\[
\frac{d\rho}{dx} = \frac{f'(s)}{1 - \frac{2
    u_{\max} t_{0}}{\rho_{\max}} f'(s)}
\]
Thus the shock occurs when $f'(s) \ne 0$ and
\[
1 - \frac{2 u_{\max} t_{0}}{\rho_{\max}} f'(s) = 0
\iff
t_{0} = \frac{\rho_{\max}}{2 u_{\max} f'(s)}	.
\]

\end{frame}
%%

\begin{frame}\frametitle{Example}

Suppose $\displaystyle \rho(x,0) = f(x) =
\frac{\rho_{\max}/3}{1+x^{2}}$.
\begin{enumerate}
\item Where is the point of maximum density initially?
\item Where is the point of maximum density at time $t > 0$?
\item When does the first shock occur?
\item Where does the first shock occur?
\end{enumerate}

\end{frame}
%%

\begin{frame}\frametitle{Solution (1 of 2)}

\begin{align*}
f(s) &= \frac{\rho_{\max}/3}{1+s^{2}}	\\
f'(s) &= -\frac{2 \rho_{\max}}{3} \, \frac{x}{(1+s^{2})^{2}}
\end{align*}
At $t = 0$ the maximum density is at $x_{0} = 0$.

\vspace*{0.10in}

\uncover<2->{%
\textbf{Recall}: for each constant $x_{0}$ the solution has
constant value $f(x_{0})$ along the line
\[
x = u_{\max} \left( 1 - \frac{2 f(x_{0})}{\rho_{\max}} \right) t + x_{0}	.
\]
\uncover<3->{%
Thus if $x_{0} = 0$ the maximum density at $t > 0$ is at
\[
x = u_{\max} \left( 1 - \frac{2 f(0)}{\rho_{\max}} \right) t =
\frac{u_{\max} t}{3}	.
\]
The point of maximum density is moving to the right at $1/3$ the
maximum speed of the vehicles.
}
}

\end{frame}
%%

\begin{frame}\frametitle{Tracking the Maximum Density}

\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{maxdensity}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Solution (2 of 2)}

The first shock arises when
\[
t_{0} = \frac{\rho_{\max}}{2 u_{\max} f'(s)}	.
\]
The maximum of $f'(s)$ occurs at $s=-1/\sqrt{3}$ and thus
\[
t_{0} = \frac{\rho_{\max}}{2 u_{\max} f'(-1/\sqrt{3})} =
\frac{4}{u_{\max} \sqrt{3}}	,
\]
is the time of the first shock.

\vspace*{0.10in}

\uncover<2->{%
The location of the first shock is
\begin{align*}
x &= u_{\max} \left( 1 - \frac{2 f(s)}{\rho_{\max}} \right) t + s	\\
	&=
u_{\max} \left( 1 - \frac{2 f(-1/\sqrt{3})}{\rho_{\max}} \right)
\frac{4}{u_{\max} \sqrt{3}} - \frac{1}{\sqrt{3}} = \frac{1}{\sqrt{3}}	.
\end{align*}
}

\end{frame}
%%

\begin{frame}\frametitle{Illustration}

\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{firstshock}}
\end{center}
\textbf{Note}: the shock occurs at a level below the maximum density.

\end{frame}
%%

%\begin{frame}\frametitle{Homework}

%\begin{itemize}
%\item Read Section $2.3$
%\item Exercises: 15--20
%\end{itemize}

%\end{frame}
%%

%%%
\end{document}

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