%%%%		-*- 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/12/2025
%%%%
%%%% Purpose:   The Heat Equation
%%%%

\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{The Heat Equation}
\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 solve the heat equation with Dirichlet boundary conditions,
\item solve the heat equation with Neumann boundary conditions,
\item solve the heat equation with Robin boundary conditions, and
\item solve the heat equation with nonhomogeneous boundary conditions.
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Dirichlet Boundary Conditions}

Find the solution to the IBVP:
\begin{align*}
u_{t}
	&= \kappa \, u_{xx}
\mbox{ for $0 < x < L$, $t > 0$}	\\
u(0, t)
	&= 0	\\
u(L, t)
	&= 0	\\
u(x, 0)
	&= \left\{ \begin{array}{ll}
x & \mbox{for $0 \le x \le L/2$,}	\\
L-x & \mbox{for $L/2 < x \le L$.}
\end{array} \right.
\end{align*}

\end{frame}
%%

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

The nontrivial product solutions must take the form,
\[
u_{n}(x, t)
	= e^{-\kappa n^{2} \pi^{2} t/L^{2}} \sin \frac{n \pi x}{L}
\]
for $n = 1, 2, \ldots$.
By the Principle of Superposition,
\[
u(x, t)
	= \sum_{n=1}^{\infty} b_{n} e^{-\kappa n^{2} \pi^{2} t/L^{2}} \sin \frac{n \pi x}{L}
\]
is also a solution to the PDE and satisfies the BCs.
Applying the initial condition yields,
\[
u(x, 0)
	= \sum_{n=1}^{\infty} b_{n} \sin \frac{n \pi x}{L}
	= \left\{ \begin{array}{ll}
x & \mbox{for $0 \le x \le L/2$,}	\\
L-x & \mbox{for $L/2 < x \le L$.}
\end{array} \right.
\]
The coefficients $b_{n}$ can be found using the Euler-Fourier integral
formulas.

\end{frame}
%%

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

Think of $f(x)$ as the $2L$-periodic, odd extension of the initial
condition.
In this case $f(x)$ is continuous on $(-\infty,\infty)$.
\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{oddextension}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Solution (3 of 4)}

\begin{align*}
b_{n}
	&= \frac{2}{L} \int_{0}^{L} f(x) \sin \frac{n \pi x}{L} \, dx	\\
	&= \frac{2}{L} \int_{0}^{L/2} x \sin \frac{n \pi x}{L} \, dx +
\frac{2}{L} \int_{L/2}^{L} (L-x) \sin \frac{n \pi x}{L} \, dx	\\
	&= \frac{L}{n^{2} \pi^{2}} \left( 2 \sin \frac{n \pi}{2} - n \pi \cos
              \frac{n \pi}{2} \right) +
\frac{L}{n^{2} \pi^{2}} \left(n \pi \cos \frac{n \pi}{2} + 2 \sin
              \frac{n \pi}{2} \right)	\\
	&= \frac{4 L}{n^{2} \pi^{2}} \sin \frac{n \pi}{2}
\end{align*}

\end{frame}
%%

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

\[
u(x, t)
	= \frac{4 L}{\pi^{2}} \sum_{n=1}^{\infty} \frac{\sin \frac{n
    \pi}{2}}{n^{2}} e^{-\kappa n^{2} \pi^{2} t/L^{2}} \sin \frac{n \pi x}{L}
\]
\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{Dirichletexample}}
\end{center}
\[
\kappa = 1 = L
\]

\end{frame}
%%

\begin{frame}\frametitle{Neumann Boundary Conditions}

Find the solution to the IBVP:
\begin{align*}
u_{t}
	&= u_{xx}
\mbox{ for $0 < x < \pi$, $t > 0$}	\\
u_{x}(0, t)
	&= 0	\\
u_{x}(\pi, t)
	&= 0	\\
u(x, 0)
	&= \left\{ \begin{array}{ll}
0 & \mbox{for $0 \le x < \pi/2$,}	\\
100 & \mbox{for $\pi/2 \le x \le \pi$.}
\end{array} \right.
\end{align*}

\end{frame}
%%

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

Assuming a product solution of the form $u(x, t) = X(x) T(t)$ then
\begin{align*}
X(x) T'(t)
	&= X''(x) T(t)	\\
\frac{X(x) T'(t)}{X(x) T(t)}
	&= \frac{X''(x) T(t)}{X(x) T(t)}
  \\
\frac{T'(t)}{T(t)}
	&= \frac{X''(x)}{X(x)} = c
\end{align*}
where $c$ is a constant.

\end{frame}
%%

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

Suppose $c = 0$, then
\begin{align*}
\frac{X''(x)}{X(x)}
	&= 0	\\
X''(x)
	&= 0	\\
X(x)
	&= A x + B	.
\end{align*}
Since $X'(0) = X'(\pi) = 0$ then $A = 0$ and $B = a_{0}/2$, where
$a_{0}$ is an arbitrary constant.

\end{frame}
%%

\begin{frame}\frametitle{Solution (3 of 8)}

Suppose $c = -\lambda^{2}$ with $\lambda > 0$.
\begin{align*}
\frac{X''(x)}{X(x)}
	&= -\lambda^{2}	\\
X''(x) + \lambda^{2} X(x)
	&= 0	\\
X(x)
	&= A \cos (\lambda x) + B \sin (\lambda x)	\\
\uncover<2->{%
\mbox{and }
X'(x)
	&= -A \lambda \sin (\lambda x) + B \lambda \cos (\lambda x)	.
}
\end{align*}
\uncover<2->{%
Since $X'(0) = X'(\pi) = 0$ then $B = 0$ and $\lambda \equiv
\lambda_{n} = n$ for $n = 1, 2, \ldots$ and $A$ is an arbitrary
constant.
Thus
\[
u_{n}(x, t)
	= e^{-n^{2} t} \cos (n x)
\]
satisfies the PDE and the BCs.
}

\end{frame}
%%

\begin{frame}\frametitle{Solution (4 of 8)}

Suppose $c = \lambda^{2}$ with $\lambda > 0$.
\begin{align*}
\frac{X''(x)}{X(x)}
	&= \lambda^{2}	\\
X''(x) - \lambda^{2} X(x)
	&= 0	\\
X(x)
	&= A \cosh (\lambda x) + B \sinh (\lambda x)	\\
\uncover<2->{%
\mbox{and }
X'(x)
	&= A \lambda \sinh (\lambda x) + B \lambda \cosh (\lambda x)	.
}
\end{align*}
\uncover<2->{%
Since $X'(0) = X'(\pi) = 0$ then $A = 0 = B$ and hence there are no
nontrivial solutions in this case.
}

\end{frame}
%%

\begin{frame}\frametitle{Solution (5 of 8)}

By the Principle of Superposition, the solution to the PDE satisfying
the BCs can be written as
\[
u(x, t)
	= \frac{a_{0}}{2} + \sum_{n=1}^{\infty} a_{n} e^{-n^{2} t} \cos
(n x)	.
\]
Applying the initial condition yields,
\[
u(x, 0)
	= \frac{a_{0}}{2} + \sum_{n=1}^{\infty} a_{n} \cos (n x)
	= \left\{ \begin{array}{ll}
0 & \mbox{for $0 \le x < \pi/2$,}	\\
100 & \mbox{for $\pi/2 \le x \le \pi$.}
\end{array} \right.
\]
The coefficients $a_{n}$ can be found using the Euler-Fourier integral
formulas.

\end{frame}
%%

\begin{frame}\frametitle{Solution (6 of 8)}

Think of $f(x)$ as the $2\pi$-periodic, even extension of the initial
condition.
\begin{align*}
a_{0}
	&= \frac{2}{\pi} \int_{0}^{\pi} f(x) \, dx
	= \frac{2}{\pi} \int_{\pi/2}^{\pi} 100 \, dx
	= 100	\\
a_{n}
	&= \frac{2}{\pi} \int_{0}^{\pi} f(x) \cos (n x) \, dx	\\
	&= \frac{2}{\pi} \int_{\pi/2}^{\pi} 100 \cos (n x) \, dx	\\
	&= -\frac{200}{n \pi} \sin \frac{n \pi}{2}
\end{align*}
\uncover<2->{%
Consequently, the formal solution to the IBVP is
\[
u(x, t)
	\sim 50 - \frac{200}{\pi} \sum_{n=1}^{\infty} e^{-n^{2} t} \frac{\sin \frac{n
    \pi}{2}}{n} \cos (n x)	.
\]
}

\end{frame}
%%

\begin{frame}\frametitle{Solution (7 of 8)}

\[
u(x, t)
	\sim 50 - \frac{200}{\pi} \sum_{n=1}^{\infty} \frac{\sin \frac{n
    \pi}{2}}{n} e^{-n^{2} t} \cos (n x)	.
\]
\begin{center}
\resizebox{1.00\textwidth}{!}{\includegraphics{neumannexample}}
\end{center}

\end{frame}
%%

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

\[
u(x, t)
	\sim 50 - \frac{200}{\pi} \sum_{n=1}^{\infty} \frac{\sin \frac{n
    \pi}{2}}{n} e^{-n^{2} t} \cos (n x)	.
\]
\begin{center}
\resizebox{0.70\textwidth}{!}{\includegraphics{neumanndensity}}
\end{center}

\end{frame}
%%

\begin{frame}\frametitle{Robin Boundary Conditions}

Find the solution to the IBVP:
\begin{align*}
u_{t}
	&= u_{xx}
\mbox{ for $0 < x < L$, $t > 0$}	\\
u_{x}(0, t)
	&= \alpha \, u(0, t)	\\
u_{x}(L, t)
	&= -\beta \, u(L, t)	\\
u(x, 0)
	&= \left\{ \begin{array}{ll}
0 & \mbox{for $0 \le x < L/2$,}	\\
100 & \mbox{for $L/2 \le x \le L$.}
\end{array} \right.
\end{align*}
Assume $\alpha > 0$ and $\beta > 0$.

\end{frame}
%%

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

Assuming a product solution of the form $u(x, t) = X(x) T(t)$ then
\begin{align*}
X(x) T'(t)
	&= X''(x) T(t)	\\
\frac{X(x) T'(t)}{X(x) T(t)}
	&= \frac{X''(x) T(t)}{X(x) T(t)}
  \\
\frac{T'(t)}{T(t)}
	&= \frac{X''(x)}{X(x)} = c
\end{align*}
where $c$ is a constant.

\end{frame}
%%

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

Suppose $c = 0$, then
\begin{align*}
\frac{X''(x)}{X(x)}
	&= 0	\\
X''(x)
	&= 0	\\
X(x)
	&= A x + B	.
\end{align*}
\uncover<2->{%
\textbf{Question}: can such a function satisfy the boundary
conditions:
\begin{align*}
A
	&= \alpha B
\mbox{ (BC at $x=0$)}	\\
A
	&= -\beta (A L + B)
\mbox{ (BC at $x=L$)}
\end{align*}
\uncover<3->{%
Eliminating $A$ from the 2nd equation using the 1st equation yields:
\[
\alpha B = -\beta (\alpha L + 1) B	.
\]
If $B=0$ then $A=0$ and $X(x) = 0$.
If $B \ne 0$ then
\[
\alpha = -\beta (\alpha L + 1)
\implies \alpha < 0
\quad\mbox{(contradiction).}
\]
}
}

\end{frame}
%%

\begin{frame}\frametitle{Solution (3 of 10)}

Suppose $c = \lambda^{2}$ with $\lambda > 0$.
\begin{align*}
\frac{X''(x)}{X(x)}
	&= \lambda^{2}	\\
X''(x) - \lambda^{2} X(x)
	&= 0	\\
X(x)
	&= A \cosh (\lambda x) + B \sinh (\lambda x)	\\
\uncover<2->{%
\mbox{and }
X'(x)
	&= A \lambda \sinh (\lambda x) + B \lambda \cosh (\lambda x)	.
}
\end{align*}
Can this type of function satisfy the boundary conditions?
\uncover<2->{%
\begin{align*}
B \lambda
	&= \alpha A	\\
A \lambda \sinh (\lambda L) + B \lambda \cosh (\lambda L)
	&= -\beta (A \cosh (\lambda L) + B \sinh (\lambda L))
\end{align*}
\uncover<3->{%
The first equation implies $A = 0 \iff B = 0$.
}
}

\end{frame}
%%

\begin{frame}\frametitle{Solution (4 of 10)}

Use the BC at $x=0$ to eliminate $A$ and $B$ from the second equation,
\begin{align*}
A \lambda \sinh (\lambda L) + \frac{\alpha A}{\lambda} \lambda \cosh (\lambda L)
	&= -\beta (A \cosh (\lambda L) + \frac{\alpha A}{\lambda} \sinh (\lambda L))	\\
\lambda \sinh (\lambda L) + \alpha \cosh (\lambda L)
	&= -\beta (\cosh (\lambda L) + \frac{\alpha}{\lambda} \sinh (\lambda L))	\\
\left( \lambda + \frac{\alpha \beta}{\lambda} \right) \sinh (\lambda L)
	&= -(\alpha + \beta) \cosh (\lambda L)	\\
\left( \lambda + \frac{\alpha \beta}{\lambda} \right) \tanh (\lambda L)
	&= -(\alpha + \beta)
\end{align*}
since $\cosh (\lambda L) \ge 1$.

\end{frame}
%%

\begin{frame}\frametitle{Solution (5 of 10)}

\[
\left( \lambda + \frac{\alpha}{\lambda} \right) \tanh (\lambda L)
	= -(\alpha + \beta)
\]
Since $\alpha > 0$, $\beta > 0$, $L > 0$, and we have assumed $\lambda
> 0$ then
\[
\tanh (\lambda L) < 0
\iff \lambda L < 0
\]
which is a contradiction.
Hence there are no nontrivial solutions when $c > 0$.

\end{frame}
%%

\begin{frame}\frametitle{Solution (6 of 10)}

Suppose $c = -\lambda^{2}$ with $\lambda > 0$.
\begin{align*}
\frac{X''(x)}{X(x)}
	&= -\lambda^{2}	\\
X''(x) + \lambda^{2} X(x)
	&= 0	\\
X(x)
	&= A \cos (\lambda x) + B \sin (\lambda x)	\\
\uncover<2->{%
\mbox{and }
X'(x)
	&= -A \lambda \sin (\lambda x) + B \lambda \cos (\lambda x)	.
}
\end{align*}
Can this type of function satisfy the boundary conditions?
\uncover<2->{%
\begin{align*}
B \lambda
	&= \alpha A	\\
-A \lambda \sin (\lambda L) + B \lambda \cos (\lambda L)
	&= -\beta (A \cos (\lambda L) + B \sin (\lambda L))
\end{align*}
\uncover<3->{%
The first equation implies $A = 0 \iff B = 0$.
}
}

\end{frame}
%%

\begin{frame}\frametitle{Solution (7 of 10)}

Use the BC at $x=0$ to eliminate $A$ and $B$ from the second equation,
\begin{align*}
-A \lambda \sin (\lambda L) + \frac{\alpha A}{\lambda} \lambda \cos (\lambda L)
	&= -\beta (A \cos (\lambda L) + \frac{\alpha A}{\lambda} \sin (\lambda L))	\\
-\lambda \sin (\lambda L) + \alpha \cos (\lambda L)
	&= -\beta (\cos (\lambda L) + \frac{\alpha}{\lambda} \sin (\lambda L))	\\
\left( \lambda - \frac{\alpha \beta}{\lambda} \right) \sin (\lambda L)
	&= (\alpha + \beta) \cos (\lambda L)
\end{align*}
\textbf{Note}:
\[
\cos (\lambda L) = 0
\iff
\lambda = \frac{(2n-1) \pi}{2 L}
\]
with $n \in \mathbb{N}$.

\end{frame}
%%

\begin{frame}\frametitle{Solution (8 of 10)}

Suppose $\displaystyle \lambda = \frac{(2n-1) \pi}{2 L}$ with $n \in
\mathbb{N}$, then $\sin (\lambda L) = \pm 1$ and
\begin{align*}
\left( \lambda - \frac{\alpha \beta}{\lambda} \right) \sin (\lambda L)
	&= (\alpha + \beta) \cos (\lambda L)	\\
\lambda - \frac{\alpha \beta}{\lambda}
	&= 0	\\
\alpha \beta
	&= \left( \frac{(2n-1) \pi}{2 L} \right)^{2}	.
\end{align*}

\vspace*{0.10in}

\uncover<2->{%
If there is no $n \in \mathbb{N}$ satisfying the last equation, then
$\cos (\lambda L) \ne 0$ and
\begin{align*}
\left( \lambda - \frac{\alpha \beta}{\lambda} \right) \sin (\lambda L)
	&= (\alpha + \beta) \cos (\lambda L)	\\
\left( \lambda - \frac{\alpha \beta}{\lambda} \right) \tan (\lambda L)
	&= \alpha + \beta	\\
\tan (\lambda L)
	&= \frac{\alpha + \beta}{\lambda - \frac{\alpha \beta}{\lambda}} =
\frac{(\alpha + \beta) \lambda}{\lambda^{2} - \alpha \beta}	.
\end{align*}
}

\end{frame}
%%

\begin{frame}\frametitle{Solution (9 of 10)}

\[
\tan (\lambda L)
	= \frac{(\alpha + \beta) \lambda}{\lambda^{2} - \alpha \beta}
\]
This equation has positive solutions which can be approximated using
Newton's method.
\begin{center}
\resizebox{0.80\textwidth}{!}{\includegraphics{tanlambda}}
\end{center}
\[
L = \alpha = \beta = 1
\]

\end{frame}
%%

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

The first few solutions are
\begin{align*}
\lambda_{1} &\approx 1.20779	\\
\lambda_{2} &\approx 3.44824	\\
\lambda_{3} &\approx 6.44095	\\
\lambda_{4} &\approx 9.53048
\end{align*}
and $\lambda_{n} \to (n-1) \pi$ as $n \to \infty$.

The corresponding eigenfunctions are
\[
X_{n}(x)
	= A_{n} \cos (\lambda_{n} x) + B_{n} \sin (\lambda_{n} x)
\]
while the product solutions have the form
\[
u_{n}(x, t)
	= e^{-\lambda_{n}^{2} t} \left(
A_{n} \cos (\lambda_{n} x) + B_{n} \sin (\lambda_{n} x)
\right)	.
\]

\end{frame}
%%

\begin{frame}\frametitle{Nonhomogeneous Boundary Conditions}

Consider the IBVP:
\begin{align*}
u_{t}
	&= \kappa u_{xx}
\mbox{ for $0 < x < L$,	$t > 0$}	\\
u(0, t)
	&= u_{0}	\\
u(L, t)
	&= u_{L}	\\
u(x, 0)
	&= f(x)
\end{align*}
Recall that the temperature in the region asymptotically approached a
steady state of
$0$ when the boundary conditions were homogeneous ($u(0, t) = u(L, t) =
0$).
Suppose that in the nonhomogeneous case the temperature distribution
approaches a nonzero steady state $U(x)$.

\end{frame}
%%

\begin{frame}\frametitle{Steady-State Solution}

Suppose
\begin{align*}
U''(x)
	&= 0
\mbox{ for $0 < x < L$}	\\
U(0)
	&= u_{0}	\\
U(L)
	&= u_{L}
\end{align*}
then $U(x) = A x + B$.
\[
U(0)
	= u_{0}
	= A (0) + B
\implies
B
	= u_{0}
\]
The other boundary condition implies
\[
U(L)
	= u_{L}
	= A L + u_{0}
\implies
A
	= \frac{u_{L} - u_{0}}{L}	.
\]
Hence the steady-state solution is
\[
U(x)
	= \frac{(u_{L} - u_{0}) x}{L} + u_{0}	.
\]

\end{frame}
%%

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

Assume the solution to the IBVP can be written as $u(x, t) = U(x) +
v(x, t)$ where $v(x, t)$ is an unknown function.

\vspace*{0.10in}

\textbf{Question}: what IBVP must $v(x, t)$ satisfy?
\begin{align*}
u_{t}
	&= \kappa u_{xx}	\\
(U(x) + v(x, t))_{t}
	&= \kappa (U(x) + v(x, t))_{xx}	\\
v_{t}
	&= \kappa v_{xx}
\mbox{ (PDE)}
\end{align*}
\uncover<2->{%
\begin{align*}
u(0, t)
	&= u_{0}	\\
U(0) + v(0, t)
	&= u_{0}	\\
v(0, t)
	&= 0
\mbox{ (BC at $x=0$)}
\end{align*}
Likewise $v(L, t) = 0$.
\uncover<3->{%
\begin{align*}
u(x, 0)
	&= f(x)	\\
U(x) + v(x, 0)
	&= f(x)	\\
v(x, 0)
	&= f(x) - U(x)
\quad\mbox{(IC at $t=0$)}
\end{align*}
}
}

\end{frame}
%%

\begin{frame}\frametitle{Time-Dependent Solution (2 of 2)}

\begin{align*}
v_{t}
	&= \kappa v_{xx}
\mbox{ for $0 < x < L$ and $t > 0$}	\\
v(0, t)
	&= 0	\\
v(L, t)
	&= 0	\\
v(x, 0)
	&= f(x) - U(x)
\end{align*}

\vspace*{0.10in}

\uncover<2->{%
\begin{align*}
\mbox{If } b_{n}
	&= \frac{2}{L} \int_{0}^{L} (f(x) - U(x)) \sin \frac{n \pi x}{L} \, dx
                       ,	\\
\mbox{then }
v(x, t)
	&= \sum_{n=1}^{\infty} b_{n} e^{-\kappa n^{2} \pi^{2} t/L^{2}}
             \sin \frac{n \pi x}{L}	,	\\
\mbox{and }
u(x, t)
	&= u_{0} + \frac{(u_{L} - u_{0}) x}{L} +
\sum_{n=1}^{\infty} b_{n} e^{-\kappa n^{2} \pi^{2} t/L^{2}}
             \sin \frac{n \pi x}{L}	.
\end{align*}
}

\end{frame}
%%

\begin{frame}\frametitle{Example}

Solve the following IBVP:
\begin{align*}
u_{t}
	&= 5 u_{xx}
\mbox{ for $0 < x < 1$ and $t > 0$}	\\
u(0, t)
	&= 10	\\
u(1,t)
	&= 20	\\
u(x, 0)
	&= 10 + 11 x - x^{2}
\end{align*}

\end{frame}
%%

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

The steady-state solution is
\[
U(x)
	= 10 + \frac{(20-10) x}{1} = 10 (1 + x)	.
\]

\vspace*{0.10in}

\uncover<2->{%
The transient solution $v(x, t)$ satisfies the IBVP:
\begin{align*}
v_{t}
	&= 5 v_{xx}
\quad\mbox{for $0 < x < 1$ and $t > 0$}	\\
v(0, t)
	&= 0	\\
v(1,t)
	&= 0	\\
v(x, 0)
	&= 10 + 11 x - x^{2} - 10 (1+x) = x - x^{2}
\end{align*}
}

\end{frame}
%%

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

\begin{align*}
b_{n}
	&= 2 \int_{0}^{1} (x - x^{2}) \sin (n \pi x) \, dx	\\
	&= \frac{4 (1 - (-1)^{n})}{n^{3} \pi^{3}}	\\
	&= \left\{ \begin{array}{ll}
0 & \mbox{if $n$ is even,}	\\
8/(n^{3} \pi^{3}) & \mbox{if $n$ is odd.}
\end{array} \right.	\\
v(x, t)
	&= \frac{8}{\pi^{3}} \sum_{n=1}^{\infty} \frac{e^{-5 (2n-1)^{2}
             \pi^{2} t}}{(2n-1)^{3}} \sin ((2n-1) \pi x)	\\
u(x, t)
	&= 10 (1 + x) + \frac{8}{\pi^{3}} \sum_{n=1}^{\infty} \frac{e^{-5 (2n-1)^{2}
             \pi^{2} t}}{(2n-1)^{3}} \sin ((2n-1) \pi x)
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{Time Dependent Boundary Conditions}

Consider the IBVP:
\begin{align*}
u_{t}	&= \kappa u_{xx}	,
\mbox{ for $0 < x < L$ and $t > 0$}	\\
u(0, t)
	&= a(t)	\\
u(L, t)
	&= b(t)	\\
u(x, 0)
	&= f(x)
\end{align*}
\begin{itemize}
\item In this situation the boundary conditions are functions of time.
\item There may not be a steady-state solution, but the approach used
  in the case of constant, nonhomogeneous BCs is useful.
\end{itemize}

\uncover<2->{%
Define a \textbf{reference function}
$\displaystyle r(x, t) = a(t) + \frac{(b(t) - a(t)) x}{L}$ and
suppose $u(x, t) = r(x, t) + v(x, t)$.

\vspace*{0.10in}

\textbf{Question}: what IBVP does $v(x, t)$ satisfy?
}

\end{frame}
%%

\begin{frame}\frametitle{PDE for $v(x, t)$}

\begin{align*}
u_{t}
	&= \kappa u_{xx}	\\
(r(x, t) + v(x, t))_{t}
	&= \kappa (r(x, t) + v(x, t))_{xx}	\\
a'(t) + \frac{(b'(t) - a'(t)) x}{L} + v_{t}
	&= \kappa v_{xx}	\\
v_{t}
	&= \kappa v_{xx} - a'(t) - \frac{(b'(t) - a'(t)) x}{L}
\end{align*}

\vspace*{0.10in}

\textbf{Note}: this PDE is nonhomogeneous.

\end{frame}
%%

\begin{frame}\frametitle{BCs for $v(x, t)$}

\begin{align*}
u(0, t)
	&= a(t)	\\
r(0, t) + v(0, t)
	&= a(t)	\\
a(t) + v(0, t)
	&= a(t)	\\
v(0, t)
	&= 0
\quad\mbox{(BC at $x=0$)}	\\
u(L, t)
	&= b(t)	\\
r(L, t) + v(L, t)
	&= b(t)	\\
b(t) + v(L, t)
	&= b(t)	\\
v(L, t)
	&= 0
\quad\mbox{(BC at $x=L$)}
\end{align*}
The boundary conditions are once again homogeneous.

\end{frame}
%%

\begin{frame}\frametitle{IC for $v(x, t)$}

\begin{align*}
u(x, 0)
	&= f(x)	\\
r(x, 0) + v(x, 0)
	&= f(x)	\\
a(0) + \frac{(b(0) - a(0)) x}{L} + v(x, 0)
	&= f(x)	\\
v(x, 0)
	&= f(x) - a(0) - \frac{(b(0) - a(0)) x}{L}
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{IBVP for $v(x, t)$}

In summary:
\begin{align*}
v_{t}
	&= \kappa v_{xx} - a'(t) - \frac{(b'(t) - a'(t)) x}{L}
\mbox{ for $0 < x < L$ and $t > 0$}	\\
v(0, t)
	&= 0	\\
v(L, t)
	&= 0	\\
v(x, 0)
	&= f(x) - a(0) - \frac{(b(0) - a(0)) x}{L}
\end{align*}

\vspace*{0.10in}

\textbf{Remarks}:
\begin{itemize}
\item This IBVP has a nonhomogeneous PDE and a non-trivial initial
  condition.
\item Search for a solution $v(x, t) = v_{1}(x, t) + v_{2}(x, t)$ for
  which $v_{1}(x, t)$ solves the homogeneous PDE with a non-zero initial
  condition and $v_{2}(x, t)$ solves a nonhomogeneous PDE with a zero
  initial condition.
\end{itemize}

\end{frame}
%%

\begin{frame}\frametitle{Sum of Solutions (1 of 2)}

Consider the two IBVPs with $0 < x < L$ and $t > 0$:
\begin{align*}
(v_{1})_{t} &= \kappa (v_{1})_{xx}	\\
v_{1}(0, t)
	&= 0	\\
v_{1}(L, t)
	&= 0	\\
v_{1}(x, 0)
	&= f(x) - \frac{(b(0)-a(0)) x}{L} - a(0)	\\
\mathstrut &{} \mathstrut	\\
\hline
\mathstrut &{} \mathstrut	\\
(v_{2})_{t} &= \kappa (v_{2})_{xx} - a'(t) - \frac{(b'(t) - a'(t)) x}{L}	\\
v_{2}(0, t)
	&= 0	\\
v_{2}(L, t)
	&= 0	\\
v_{2}(x, 0)
	&= 0
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{Sum of Solutions (2 of 2)}

If $v_{1}(x, t)$ solves the 1st IBVP and $v_{2}(x, t)$ solves the 2nd
IBVP, then $v(x, t) = v_{1}(x, t) + v_{2}(x, t)$ solves:
\begin{align*}
v_{t}
	&= \kappa v_{xx} - a'(t) - \frac{(b'(t) - a'(t)) x}{L}
\mbox{ for $0 < x < L$ and $t > 0$}	\\
v(0, t)
	&= 0	\\
v(L, t)
	&= 0	\\
v(x, 0)
	&= f(x) - a(0) - \frac{(b(0) - a(0)) x}{L}
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{Solution of IBVP with Homogeneous PDE}

The IBVP,
\begin{align*}
(v_{1})_{t}
	&= \kappa (v_{1})_{xx}
\mbox{ for $0 < x < L$, $t > 0$}	\\
v_{1}(0, t)
	&= 0	\\
v_{1}(L, t)
	&= 0	\\
v_{1}(x, 0)
	&= f(x) - \frac{(b(0)-a(0)) x}{L} - a(0)
\end{align*}
has solution
\[
v_{1}(x, t)
	= \sum_{n=1}^{\infty} b_{n} e^{-\kappa n^{2} \pi^{2} t/L^{2}}
\sin \frac{n \pi x}{L}
\]
where
\[
b_{n}
	= \frac{2}{L} \int_{0}^{L} \left( f(x) -
  \frac{(b(0)-a(0)) x}{L} - a(0) \right) \sin \frac{n \pi x}{L} \, dx	.
\]

\end{frame}
%%

\begin{frame}\frametitle{Solution of IBVP with Nonhomogeneous PDE}

We will assume the solution to the IBVP:
\begin{align*}
(v_{2})_{t}
	&= \kappa (v_{2})_{xx} - a'(t) - \frac{(b'(t) - a'(t)) x}{L}
\mbox{ for $0 < x < L$, $t > 0$}	\\
v_{2}(0, t)
	&= 0	\\
v_{2}(L ,t)
	&= 0	\\
v_{2}(x, 0)
	&= 0
\end{align*}
is of the form
\[
v_{2}(x, t)
	= \sum_{n=1}^{\infty} b_{n}(t) e^{-\kappa n^{2} \pi^{2} t/L^{2}}
\sin \frac{n \pi x}{L}
\]
where the coefficients $b_{n}$ are functions of $t$.
Differentiate this solution and substitute it into the nonhomogeneous
PDE.

\end{frame}
%%

\begin{frame}\frametitle{Verifying the Solution}

\begin{align*}
(v_{2})_{xx}
	&= -\sum_{n=1}^{\infty} \frac{n^{2} \pi^{2}}{L^{2}} b_{n}(t) e^{-\kappa n^{2}
              \pi^{2} t/L^{2}} \sin \frac{n \pi x}{L}	\\
(v_{2})_{t}
	&= \sum_{n=1}^{\infty} \left( b_{n}'(t) e^{-\kappa n^{2} \pi^{2} t/L^{2}} -
              \frac{\kappa n^{2} \pi^{2}}{L^{2}} b_{n}(t) e^{-\kappa n^{2}
              \pi^{2} t/L^{2}} \right) \sin \frac{n \pi x}{L}
\end{align*}
Since $\displaystyle (v_{2})_{t} - \kappa (v_{2})_{xx} = -a'(t) -
\frac{(b'(t) - a'(t)) x}{L}$ then
\[
\sum_{n=1}^{\infty}
b_{n}'(t) e^{-\kappa n^{2} \pi^{2} t/L^{2}} \sin \frac{n \pi x}{L}
	= -a'(t) - \frac{(b'(t) - a'(t)) x}{L}	.
\]
Multiply both sides by $\sin (m \pi x/L)$ and integrate over $[0,L]$.

\end{frame}
%%

\begin{frame}\frametitle{Integration and Orthogonality}

\begin{align*}
\frac{L}{2} b_{m}'(t) e^{-\kappa m^{2} \pi^{2} t/L^{2}}
	&= - \int_{0}^{L} \left( a'(t) + \frac{(b'(t) - a'(t)) x}{L} \right) \sin
  \frac{m \pi x}{L} \, dx	\\
{}	&= -\frac{L}{m \pi} (a'(t) - (-1)^{m} b'(t))	\\
b_{m}'(t)
	&= \frac{2}{m \pi} e^{\kappa m^{2} \pi^{2} t/L^{2}} ((-1)^{m} b'(t) - a'(t))
\end{align*}
\uncover<2->{%
Integrate both sides with respect to $t$.
\begin{align*}
\int_{0}^{t} b_{m}'(s) \, ds
	&= \frac{2}{m \pi} \int_{0}^{t} e^{\kappa m^{2} \pi^{2} s/L^{2}} ((-1)^{m}
              b'(s) - a'(s)) \, ds	\\
b_{m}(t) - b_{m}(0)
	&= \frac{2}{m \pi} \int_{0}^{t} e^{\kappa m^{2} \pi^{2} s/L^{2}} ((-1)^{m}
              b'(s) - a'(s)) \, ds
\end{align*}
Since $v_{2}(x, 0) = 0$ then $b_{m}(0) = 0$ for $m \in \mathbb{N}$.
}

\end{frame}
%%

\begin{frame}\frametitle{Assembling the Solution}

\begin{align*}
r(x, t)
	&= a(t) + \frac{(b(t) - a(t)) x}{L}	\\
v_{1}(x, t)
	&= \sum_{n=1}^{\infty} b_{n} e^{-\kappa n^{2} \pi^{2} t/L^{2}} \sin \frac{n
              \pi x}{L}	\\
v_{2}(x, t)
	&= \sum_{n=1}^{\infty} \frac{2}{n \pi} \left[
\int_{0}^{t} e^{-\kappa n^{2} \pi^{2} (t-s)/L^{2}} ((-1)^{n} b'(s) - a'(s)) \, ds
\right] \sin \frac{n \pi x}{L}	\\
u(x, t)
	&= r(x, t) + v_{1}(x, t) + v_{2}(x, t)
\end{align*}

\end{frame}
%%

\begin{frame}\frametitle{Example}

Find the solution to the following IBVP.
\begin{align*}
u_{t}
	&= u_{xx}
\mbox{ for $0 < x < 1$ and $t > 0$}	\\
u(0, t)
	&= t	\\
u(1, t)
	&= 1 + \sin t	\\
u(x, 0)
	&= x
\end{align*}

\vspace*{0.10in}

\uncover<2->{%
The reference function is
\[
r(x, t)
	= t + (1 - t + \sin t) x	.
\]
}

\end{frame}
%%

\begin{frame}\frametitle{Associated Homogeneous IVBP}

\begin{align*}
(v_{1})_{t}
	&= (v_{1})_{xx}
\mbox{ for $0 < x < 1$ and $t > 0$}	\\
v_{1}(0, t)
	&= 0	\\
v_{1}(1, t)
	&= 0	\\
v_{1}(x, 0)
	&= x - \left( 0 + (1 - 0 + \sin 0) x \right)
	= x - x = 0
\end{align*}
Hence $v_{1}(x, t) = 0$.

\end{frame}
%%

\begin{frame}\frametitle{Associated Nonhomogeneous IVBP}

\begin{align*}
(v_{2})_{t}
	&= (v_{2})_{xx} - 1 + (1 - \cos t) x
\mbox{ for $0 < x < 1$ and $t > 0$}	\\
v_{2}(0, t)
	&= 0	\\
v_{2}(1, t)
	&= 0	\\
v_{2}(x, 0)
	&= 0
\end{align*}
Assume solution $v_{2}(x, t)$ has the form
\[
v_{2}(x, t)
	= \sum_{n=1}^{\infty} b_{n}(t) e^{-n^{2} \pi^{2} t} \sin
(n \pi x)
\]
where
\[
b_{n}(t)
	= \frac{2}{n \pi} \int_{0}^{t}
e^{n^{2} \pi^{2} s} ((-1)^{n} \cos s - 1) \, ds	.
\]

\end{frame}
%%

\begin{frame}\frametitle{Calculation of $b_{n}(t)$}

\begin{align*}
b_{n}(t)
	&= \frac{2}{n \pi} \int_{0}^{t}
e^{n^{2} \pi^{2} s} ((-1)^{n} \cos s - 1) \, ds	\\
	&= \frac{1 - e^{n^{2} \pi^{2} t}}{n^{2} \pi^{2}} -
\frac{(-1)^{n} n^{2} \pi^{2}}{1 + n^{4} \pi^{4}} +
\frac{(-1)^{n} e^{n^{2} \pi^{2} t}}{1 + n^{4} \pi^{4}} (n^{2} \pi^{2}
              \cos t + \sin t)
\end{align*}

\vspace*{0.10in}

\[
u(x, t)
	= t + (1 - t + \sin t) x + \sum_{n=1}^{\infty} b_{n}(t)
e^{-n^{2} \pi^{2} t} \sin (n \pi x)
\]

\end{frame}
%%

\begin{frame}\frametitle{Graph}

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

\end{frame}
%%

%\begin{frame}\frametitle{Homework}

%\begin{itemize}
%\item Read Section $4.2$
%\item Exercises: 4, 5, 6
%\end{itemize}

%\end{frame}
%%

%%%
\end{document}

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