%\documentclass[c]{beamer}

%\usecolortheme{whale}


\documentclass[xcolor=dvipsnames,envcountsect]{beamer} 
%\documentclass{beamer}
\beamertemplatenavigationsymbolsempty 
\usecolortheme[named=Blue]{structure} %change
%\usecolortheme{seahorse}
%\usecolortheme{rose}
 %default blue to brown
%\usetheme{Warsaw}
%\usetheme{CambridgeUS}
\useoutertheme{infolines}
%\usecolortheme{dolphin}
%\usefonttheme{serif}
\usetheme{Madrid}

%\addtocounter{framenumber}{-5} 
%\setbeamertemplate{footline}[default] 
\usefonttheme{professionalfonts} % using non standard fonts for beamer
%\usefonttheme{serif} % default family is serif


\usepackage{multicol}
%\usepackage[compatibility=false]{caption}
%\usepackage{subfig}
%\usepackage{algorithmic}

%\usepackage[caption=false]{subfig}
\usepackage{amsmath}
\DeclareMathOperator{\sech}{sech}
\DeclareMathOperator{\csch}{csch}

%\usetheme{Frankfurt}
%\usetheme{AnnArbor}
% % % % % % % % % % %
%\usepackage{fancyhdr}
%\usepackage{graphicx}
%\usepackage{caption}
%\usepackage{tikz,siunitx}
%
%\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
%
%\usetikzlibrary{automata,arrows}
%\usepackage{subcaption}
%\usepackage{enumitem}
%\setlist{nolistsep}
%\usepackage{float}
% % % % % % % % % % %


\usepackage{verbatim}
\usepackage{bm}
\usepackage[all,cmtip]{xy}
\usepackage[framemethod=default]{mdframed}
\def\Ker{\textrm {Ker\,}}
\def\Im{\textrm{Im\,}}
\def\Z{\mathbb{Z}}
\def\N{\mathcal{N}}
\def\Z{\mathbb{Z}}
\def\F{\mathbb{F}}
\def\Aut{\mathrm{Aut}}
\def\rightiso{\xrightarrow{\simeq}}
\def\B{B}
\def\H{H}
\def\A{\mathcal{A}}
\def\Bb{\overline{B}}
\def\Rb{\overline{R}}
%\def\p{} 
\def\p{\pause}
\def\cl{\color{blue}}
\def\clg{\color{red}}
%\usefonttheme{structuresmallcapsserif}
\def\cl{\color{blue}}
\def\clg{\color{red}}



\setbeamertemplate{theorems}[numbered]



\newtheorem{proposition}{Proposition}[section]
\newtheorem*{conjecture}{Conjecture}
%\theoremstyle{definition} \newtheorem{algorithm}{Algorithm}[section]
\theoremstyle{definition} \newtheorem{remark}{Remark}[section]


\usepackage{ifthen}

% This is the file main.tex


\newcommand\uleft[2]{\,{}^{#1}\hspace*{-.1em}{#2}}
\def\idgroup{\mathbf{1}}
\newcommand\rdef[1]{\textit{\textcolor{blue}{#1}}}
\newcommand\mdef[1]{\textcolor{Brown}{#1}}

\newcommand\link[2]{\hyperlink{#2}{\beamergotobutton{#1}}}

\def\GAP{{\sf GAP} }
\def\HAP{{\sf HAP} }
\def\XMod{{\sf XMod}}
\def\C{\mathcal{C}}
\def\ZG{\mathbb{Z}G}
\input{rbg}
\def\minusvspace{\vspace*{-18pt}}
\def\xyscale{\xymatrixrowsep{0.25in} \xymatrixcolsep{0.25in}}

\def\xysmall{\xymatrixrowsep{0.15in} \xymatrixcolsep{0.15in}} 
\def\Ne{\mathcal{N}}
\def\CW{\textrm{CW}}
\parskip 0.1in

\input{def}

\def\xd{\vspace*{10pt}}
\def\ixd{\vspace*{3pt}}



 




\title[]{MA140-Engineering Calculus}
\author[ Lecture 34 ]{\large{ Lecture 34} 
\and %\\ \small{Supervisor: Dr. John Burns}
\\ 
 \includegraphics[scale=0.0]{Figures/lec14.jpg}}
%\date[June 2-4, 2016]{June 2-4, 2016}
%\institute[Uppsala University]{ }


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


\section{MA140}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}

{\textcolor{red}{Differential Equations:}}\\
\begin{definition}
An equation involving a derivative is a differential equation. For example $$\frac{dy}{dt}=ky \enspace (\textcolor{red} {\star})$$
where $k$ is some constant and $y$ some function of $t$.
\end{definition}
{\textcolor{red}{Are there any solutions to the above equation?}}\\
Consider for instance $$y=e^{kt}$$
Then: $$\frac{dy}{dt}=ke^{kt}=ky$$ So $y=e^{kt}$ is a solution of $(\textcolor{red} {\star})$,  also $y=5e^{kt}$ satisfies the equation  so we see that $$y=Ae^{kt}$$ is a solution to $(\textcolor{red} {\star})$ for any constant $A$  
\end{frame}
\begin{frame}

{\textcolor{red}{World Population:}}\\
\begin{example}
Suppose that the world population in $1960$ was $3.06$ billion, also suppose during this period the world population increased by $2\%$ per year. Calculate today's population.
\end{example}
Strategy: Start with a simple model and modify it if necessary\\
Let $y(t)=$ world population at time $t$, measured in years.\\
 {\textcolor{red}{Malthusian Law:}}\\
 In $1798$ English economist Thomas Malthus suggested that the rate of change of a population is proportional to the size of the population. 
\begin{definition}
 Malthusian Law: $$\frac{dy}{dt}=ky$$
 \end{definition} 
\end{frame}
\begin{frame}
This means that at time $t$ the world population is $$y=Ae^{kt}$$
for some constants $A,k$\\
Let's start time $t=0$ in $1960$, so $$y(0)=3.06 \enspace billion=Ae^{0k}=A \Rightarrow A=3.06 \enspace billion$$
$$y(1)=1.02 y(0)$$
$$y(2)=1.02 y(1)=(1.02)^{2} y(0)$$
$$y(3)=1.02 y(2)=(1.02)^{3} y(0)$$
So in general: $$y(t)=(1.02)^{t} y(0)\Rightarrow \frac{y(t)}{y(0)}=(1.02)^{t}=\frac{Ae^{kt}}{A}=e^{kt}$$
So $e^{k}=1.02$, therefore:$$\ln(e^{k})=\ln(1.02) \Rightarrow k\ln(e)=\ln(1.02)\Rightarrow k=\ln(1.02)=0.0198$$
So roughly $$k=0.02$$
\end{frame}
\begin{frame}
Therefore: $$y(t)=3.06e^{0.02t}$$
Now let's calculate today's population using our model. $$t=2019-1960=59$$
So: $$y=3.06e^{0.02 \times 59}\approx 9.843 \enspace billion$$ 
\end{frame}
\begin{frame}
\begin{definition}
A {\bf differential equation} is an equation containing derivatives (we often write {\bf D.E.} for differential equation). For example: 
\begin{itemize}
\item $\frac{dy}{dx} = 2xy$
\item $\frac{d^2y}{dx^2}+5\frac{dy}{dx}-4y = e^x$
\end{itemize}
\end{definition}
\begin{definition}
The {\bf order of a D.E.} is the order of the highest derivative in the D.E. For example:
\begin{itemize}
\item $\frac{dy}{dx} = 2xy$ is a first order differential equation
\item $\frac{d^2y}{dx^2}+5\frac{dy}{dx}-4y = e^x$ is a second order differential equation
\end{itemize} 
\end{definition}
\end{frame}
\begin{frame}

{\textcolor{red}{Separable Differential Equations:}}
\begin{definition}
A first order D.E. of the form $$\frac{dy}{dx} = g(x)h(y)$$ is called a {\bf separable D.E.}\\
(where $g(x)$ is a function of $x$ and $h(y)$ is a function of $y$).
\end{definition}
This D.E. can be solved as follows:\\
$$\frac{1}{h(y)} \frac{dy}{dx} = g(x) \Rightarrow \int \frac{1}{h(y)} dy = \int g(x) dx$$
Then integrate and solve for $y$ if possible.
\end{frame}
\begin{frame}
\begin{example}
Solve the separable D.E. $$\frac{dy}{dx} = \frac{3x^2}{\sin y}$$
\end{example}
$$\sin y dy = 3x^2 dx \Rightarrow \int \sin y dy = 3\int x^2 dx $$
$$\Rightarrow -\cos y = x^3 +C \Rightarrow \cos y = -x^3-C$$
$$\Rightarrow \cos ^{-1}(\cos y) = \cos ^{-1} (-x^3-C) \Rightarrow y=\cos^{-1}(-x^3-C)$$
\end{frame}
\begin{frame}
\begin{example}
Solve the separable D.E. $$\frac{dy}{dx} = 1+y^{2}$$
Given that when $x=0$ then $y=0$
\end{example}
$$\frac{1}{1+y^{2}}\frac{dy}{dx}=1\Rightarrow \int \frac{1}{1+y^{2}} dy=\int 1 dx$$
Let $y=\tan \theta$ so $dy=\sec^{2} \theta d\theta$. Therefore: 
$$\int \frac{1}{1+\tan^{2} \theta} \sec^{2} \theta d\theta=\int dx$$
$$\Rightarrow \int d\theta=\int dx$$ So: $$\theta=x+c$$

\end{frame}
\begin{frame}
Now $x=0, y=0 \Rightarrow 0=\tan \theta \Rightarrow \theta=0$, thus $$0=0+c\Rightarrow c=0$$
Therefore $\theta=x$ and $y=\tan x$ is our solution.
\end{frame}
\begin{frame}

{\textcolor{red}{First Order Linear Differential Equations (The Integrating Factor Method):}}
\begin{definition}
A D.E. of the form $$\frac{dy}{dx} + P(x)y = Q(x)$$ is called a {\bf first order linear D.E.}, where $P(x)$ and $Q(x)$ are functions of $x$.
\end{definition}
We can find the general solution of this D.E. as follows:\\
1.) Find the {\bf integrating factor} $$e^{\int P(x)dx}$$
2.) Multiply the D.E. by the integrating factor (I.F.) to get:
$$e^{\int P(x)dx} \left( \frac{dy}{dx} + P(x)y \right) = e^{\int P(x) dx}Q(x) \enspace (\textcolor{red} {\star})$$

\end{frame}
\begin{frame}
3.) Note that the L.H.S. of $(\textcolor{red} {\star})$ equals:
$$\frac{d}{dx} (y e^{\int P(x)dx} )$$ So $(\textcolor{red} {\star})$ becomes:
$$d(ye^{\int P(x)dx}) = e^{\int P(x)dx} Q(x)dx$$
4.) Integrate both sides and solve for $y$.\\

This algorithm is called the {\bf integrating factor method}.
\end{frame}
\begin{frame}
\begin{example}
Solve the first order linear differential equation $$\frac{dy}{dx}-3y=0$$ using the integrating factor method.

\end{example}
1.) $$I.F. = e^{\int P(x)dx} = e^{\int -3dx} = e^{-3x}$$
(note that we do not include the arbitrary constant $C$).\\
2.) Multiply the D.E. by the I.F. to get 
$$e^{-3x}(\frac{dy}{dx}-3y) = 0e^{-3x}\enspace (\textcolor{red} {\star})$$
3.) Recall that the L.H.S. of $(\textcolor{red} {\star})$ equals $$\frac{d}{dx}(ye^{-3x})$$

\end{frame}
\begin{frame}
therefore $$\frac{d}{dx}(ye^{-3x}) = 0 \Rightarrow d(ye^{-3x}) = 0dx$$
4.) Integrate and solve for $y$:
$$\int d(ye^{-3x}) = \int 0dx
\Rightarrow ye^{-3x} = 0+C
\Rightarrow y=Ce^{3x}$$
\end{frame}
\end{document}