\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
%\usepackage{slide-article-tom}
\usepackage[landscape]{slide-article-tom}


\ifx\pdfoutput\undefined
     \usepackage[dvips]{graphicx}
\else
     \usepackage[pdftex]{graphicx}
     \pdfcompresslevel9
\fi

\usepackage[all]{xy}
\setlength{\unitlength}{1cm}

%\usepackage{cyrillic}
%\newcommand{\cyrrm}{\fontencoding{OT2}\selectfont\textcyrup}
%\newcommand{\cyrit}{\fontencoding{OT2}\selectfont\textcyrit}
%\newcommand{\cyrsl}{\fontencoding{OT2}\selectfont\textcyrsl}
%\newcommand{\cyrsf}{\fontencoding{OT2}\selectfont\textcyrsf}
%\newcommand{\cyrbf}{\fontencoding{OT2}\selectfont\textcyrbf}
%\newcommand{\cyrsc}{\fontencoding{OT2}\selectfont\textcyrsc}
%%%% cyrrm = "Roman", or really upright, normal font
%%%% cyrit = Italic (cursive forms of letters)
%%%% cyrsl = Italic (non-cursive forms of letters)
%%%% cyrsf = Sans-serif
%%%% cyrbf = Bold-face 

%\usepackage[OT2,T1]{fontenc}
%\DeclareSymbolFont{cyrletters}{OT2}{wncyr}{m}{n}
%\DeclareMathSymbol{\Sha}{\mathalpha}{cyrletters}{"58}

\usepackage{fixltx2e}

\usepackage{wrapfig}

\usepackage{amsthm}
\newtheorem*{mydef}{Definition}
\theoremstyle{definition}

\usepackage[OT2,T1]{fontenc} 
%\usepackage[T2A,T1]{fontenc} 
\input cyracc.def
\font\tencyr=wncyr10 
\font\tencyb=wncyb10 
\font\tencyi=wncyi10 
\font\twlcyr=wncyr10 at 12pt
\font\twlcyb=wncyb10 at 12pt 
\font\twlcyi=wncyi10 at 12pt 
\font\cyrtwntyfr=wncyr10 at 24pt
\font\cybtwntyfr=wncyb10 at 24pt 
\font\cyitwntyfr=wncyi10 at 24pt 
\font\cyrtwntyfv=wncyr10 at 25pt
\font\cybtwntyfv=wncyb10 at 25pt 
\font\cyitwntyfv=wncyi10 at 25pt
\font\cyrtwntysx=wncyr10 at 26pt
\font\cybtwntysx=wncyb10 at 26pt 
\font\cyitwntysx=wncyi10 at 26pt

%\font\etcmcyr=cmcyr17 at 24pt
%\font\etcmcyb=cmcyb17 at 24pt 
%\font\etcmcyi=cmcyi17 at 24pt 

%\newcommand\cyr{\twlcyr\cyracc}
%\newcommand\cyb{\twlcyb\cyracc}
%\newcommand\cyi{\twlcyi\cyracc}
\newcommand\twntyfrcyr{\cyrtwntyfr\cyracc}
\MakeRobust{\twntyfrcyr}
\newcommand\twntyfrcyb{\cybtwntyfr\cyracc}
\MakeRobust{\twntyfrcyb}
\newcommand\twntyfrcyi{\cyitwntyfr\cyracc}
\MakeRobust{\twntyfrcyi}
\newcommand\twntyfvcyr{\cyrtwntyfv\cyracc}
\MakeRobust{\twntyfvcyr}
\newcommand\twntyfvcyb{\cybtwntyfv\cyracc}
\MakeRobust{\twntyfvcyb}
\newcommand\twntyfvcyi{\cyitwntyfv\cyracc}
\MakeRobust{\twntyfvcyi}
\newcommand\twntysxcyr{\cyrtwntysx\cyracc}
\MakeRobust{\twntysxcyr}
\newcommand\twntysxcyb{\cybtwntysx\cyracc}
\MakeRobust{\twntysxcyb}
\newcommand\twntysxcyi{\cyitwntysx\cyracc}
\MakeRobust{\twntysxcyi}

\usepackage{tikz}
\usetikzlibrary{backgrounds,calc,arrows,shapes.arrows}
\usepackage{calc}

\tikzset{
%MyCube/.style={scale=1.0,x={(-.4cm,-0.3cm)},y={(0.6cm,-0.3cm)},z={(0.2cm,0.7cm)}},	
MyCube/.style={scale=1.0,x={(-0.55cm,-0.3cm)},y={(1cm,0cm)},z={(0cm,1cm)}},
	MyFaceA/.style={green!70!,draw=black},
	MyFaceB/.style={blue!50!,draw=black},
	MyFaceC/.style={blue!30!green!30!,draw=black}
	}

\newcommand{\cube}[4]{%
	% parameters #1,#2,#3 = coordinates of the center, parameter #4 = length of edge
 	\pgfmathparse{0.5*#4}%
	\let\sd\pgfmathresult{}%
 	\coordinate (A) at ({#1+\sd},{#2+\sd},{#3+\sd});
 	\coordinate (E) at ({#1+\sd},{#2+\sd},{#3-\sd});
	\coordinate (B) at  ({#1+\sd},{#2-\sd},{#3+\sd});
	\coordinate (F) at  ({#1+\sd},{#2-\sd},{#3-\sd});
	\coordinate (C) at  ({#1-0.7*\sd},{#2-0.7*\sd},{#3+\sd});
	\coordinate (G) at  ({#1-\sd},{#2-\sd},{#3-\sd});
 	\coordinate (D) at ({#1-0.7*\sd},{#2+\sd},{#3+\sd});
 	\coordinate (H) at ({#1-0.7*\sd},{#2+\sd},{#3-0.7*\sd});
	\fill[MyFaceA] (A)--(E)--(H)--(D)--cycle;
	\fill[MyFaceB] (A)--(B)--(C)--(D)--cycle;
	\fill[MyFaceC] (A)--(B)--(F)--(E)--cycle;
	\draw (A)--(E)--(H)--(D)--cycle;
	\draw (D)--(C)--(B)--(A);
	\draw (B)--(F)--(E);
}

\usepackage[titles]{tocloft}
\setlength{\cftbeforesecskip}{-2ex}
\setlength{\cftbeforesubsecskip}{-2ex}

\usepackage{hyperref}

\hypersetup{colorlinks,
            linkcolor=blue,
            citecolor=blue,
            %pdfpagemode=FullScreen
            pdfpagemode=UseNone
            }


%\newcommand\@linkcolor{red}
%\newcommand\@linkcolor{blue}
%\newcommand\@anchorcolor{black}
%\newcommand\@citecolor{red}
%\newcommand\@filecolor{cyan}
%\newcommand\@urlcolor{magenta}
%\newcommand\@menucolor{red}
%\newcommand\@pagecolor{red}


\newcommand\pagedone{\newpage}

\newcommand\tthdump[1]{#1}


\newcommand\sectionhead[1]{\begin{center}\section*{#1 \hyperlink{Contents}{\hfil$\leftarrow$}}
             \end{center}
     \addcontentsline{toc}{section}{#1}
     \vspace{-\baselineskip}
     }
     
\newcommand\subsectionhead[1]{\begin{center}\subsection*{#1 \hyperlink{Contents}{\hfil$\leftarrow$}}
             \end{center}
     \addcontentsline{toc}{subsection}{#1}
     \vspace{-\baselineskip}
     }
     
\newcommand\cyrsubsectionhead[1]{\begin{center}\subsection*{#1 \hyperlink{Contents}{\hfil$\leftarrow$}}
             \end{center}
     \addcontentsline{toc}{subsection}{#1}
     \vspace{-\baselineskip}
     }


\newcommand\exercises[1]{\begin{center}\subsection*{#1 -~exercises
            \hyperlink{Contents}{\hfil$\leftarrow$}}\end{center}
    \addcontentsline{toc}{subsection}{#1 (exercises)}
     \vspace{-\baselineskip}
     }
     

\newcommand\quotesection[1]{\begin{center}{\LARGE\hypertarget{#1}
     {#1}\hyperlink{The quotes}{\hfil$\twoheadleftarrow$}}\end{center}}

\newcommand\httimes{\times}

\newcommand\mybigtriangledown{\bigtriangledown}

\newcommand\htvec[1]{\vec{#1}}

\newcommand\myspan{\mathrm{span}}
\newcommand\mymatrix{\mathrm{matrix}}

\newcommand\myreal{\mathbb{R}}

\newcommand\mycomplex{\mathbb{C}}
\newcommand\myfield{\mathbb{F}}
\newcommand\myquaternions{\mathbb{H}}
\newcommand\myrationals{\mathbb{Q}}
\newcommand\myintegers{\mathbb{Z}}

%\newcommand\dim\mathrm{dim}
\newcommand\im{\mathrm{im}}
\newcommand\deriv{\mathrm{D}}
\newcommand\trace{\mathrm{trace}}
\newcommand\detm{\mathrm{det}_m}
\newcommand\detv{\mathrm{det}_v}
\newcommand\perm{\mathrm{perm}}
\newcommand\sign{\mathrm{sign}}

% kets and bras etc.
\newcommand\ket[1]{|{#1}\rangle}
\newcommand\bra[1]{\langle{#1}|}
\newcommand\braket[2]{\langle{#1}|{#2}\rangle}


% defines a 2 element column vector.
\newcommand\col[2]{\left(\begin{array}{c}#1\\#2\end{array}\right)}
\newcommand\tcol[2]{(#1, #2)^T}


%\includeonly{Linear-String, Discrete-Linear, Discrete-Nonlinear}
%\includeonly{Discrete-Nonlinear}
%\includeonly{}


\begin{document}
\raggedright

\pagestyle{myfooters}
%\pagestyle{plain}

\thispagestyle{empty}

%Slide 1
\title{{\LARGE\bf Exponentials}\newline
\newline
}
\author{
\begin{wrapfigure}{r}{0.35\textwidth}
  \vspace{-1cm}
  \begin{center}
   %% \includegraphics[width=0.15\textwidth]{tom-carter-QR.png}
    \includegraphics[width=0.2\textwidth]{tom-carter-QR-pic.png}
  \end{center}
  \end{wrapfigure}
      Tom Carter \newline
      \newline
     Computer Science\newline
     CSU Stanislaus
%Computer Science\newline
%CSU Stanislaus\newline
\vfill
{\hyperref{http://csustan.csustan.edu/\~tom/Lecture-Notes/Exponential/Exponential.pdf}{}{}
     {http://csustan.csustan.edu/\~\ tom/Lecture-Notes/Exponential/Exponential.pdf}}
}


%\date{Fall, 2011}
\date{\today}


\maketitle

%Slide 2
%% \sectionhead{Our general topics:}
%% %%tth:\begin{itemize}
%% %%tth:\item
%% \tthdump{\hyperlink{Why differentiable manifolds}
%%                {\ $\circledcirc$ Why differentiable manifolds\newline}}
%% %%tth:\makehyperlink{Why differentiable manifolds}
%% %%tth:\item
%% \tthdump{\hyperlink{References}
%% 	        {$\circledcirc$ References\newline}} 
%% %%tth:\makehyperlink{References}
%% %%tth:\end{itemize}
%% 
%% (ex):  exercises.
%% 
%% \pagedone

\renewcommand\contentsname{Our general topics:\hypertarget{Contents}{}}
%% \newcommand\listfigurename{List of Figures}
%% \newcommand\listtablename{List of Tables}

\tableofcontents

\pagedone




\sectionhead{Starting with interest}

We'll start by looking at (compound) interest.  Suppose we are a bank, offering "savings accounts"
to our customers.  We offer savings accounts that pay interest at an annual rate $r$, so that if someone
puts $P$ dollars (the ``principal'') in their account at the beginning of the year, then at the end of the year they will
have
$$  P_{new} = P_{orig} * ( 1 + r )$$
in their account.

Now, suppose that a customer who put $P$ dollars in their account at the beginning of the year comes in
after 6 months ($\frac{1}{2}$ year), and wants to withdraw their money "plus interest."  How much should we
give them?  If we are a mean bank (or don't care about keeping our customers), we will say that since they
didn't leave their money in the account for the entire year, we don't owe them any interest yet, and will give
them back their $P$ dollars.  On the other hand, we may say, "Well, we got to use their money for half a year,
so we should give them their account earnings for the half year," so we should give them
$$  P_{new} = P_{orig} * ( 1 + \frac{r}{2} )$$
But once we do that, a clever customer will come in after six months, withdraw their money plus interest, and
they turn right around and deposit their money back in the account!  Now, how much money will be in this
customer's account at the end of the year (we're assuming that at the end of the year -- Dec. 31 -- we credit
every customer's account with the interest their account has earned for the year).   This clever customer will have
an account balance of
$$  P_{new} = P_{orig} * ( 1 + \frac{r}{2} ) * ( 1 + \frac{r}{2} ) = P_{orig} * ( 1 + \frac{r}{2} )^2.$$

Well, before long word will get out, and all customers will want to take advantage of this opportunity for increased
earnings, and all our customers will be coming in every six months, withdrawing their money and re-depositing it.
Then, for their (and our) convenience, we will offer this as an "automatic" process.  In other words, we will "compound
semi-annually."  Not only that, we will also be able to gain an advertising competitive advantage over the bank
down the street.  In particular, we can quote an "effective interest rate" in our advertisements.
\pagedone
So, for example, (in a mythical world . . . :-) if we are paying 6\% interest compounded semi-annually, then we can tell
our customers that our "effective interest rate" is 6.09\%, using the calculation:
	\begin{align*}
                \left(1 + \frac{0.06}{2}\right)^2 & =  (1 + 0.03)^2 \\
                                                  & =  1 + 2 * 0.03 + 0.03^2 \\
                                                  & =  1 + 0.06 + 0.0009 \\
                                                  & =  1 + 0.0609
           \end{align*}

Of course, now some clever customer will start coming in every 3 months instead, so the bank will start compounding
quarterly:
     \begin{align*}
                \left(1 + \frac{0.06}{4}\right)^4 & =  (1 + 0.015)^4 \\
                                                  & =  1 + 0.06136
           \end{align*}
or even weekly:
      \begin{align*}
                \left(1 + \frac{0.06}{52}\right)^{52} & =  1.0617998
           \end{align*}
           
Now, obviously, your boss will ask you what the limit of this process is.  What if we compound "continuously"?
$$P_{new} = P_{orig} * \lim_{n \to \infty}\left(1 + \frac{r}{n}\right)^n$$
where $r$ is the nominal annual interest rate.

So now we want to evaluate $$ \lim_{n \to \infty}\left(1 + \frac{r}{n}\right)^n.$$

We do this using a standard exponential/log trick:
     \begin{align*}
                \lim_{n \to \infty}\left(1 + \frac{r}{n}\right)^n & =   e^{\ln\left(\lim_{n \to \infty}\left(1 + \frac{r}{n}\right)^n\right)}\\
                                                  & =  e^{\lim_{n \to \infty}\ln\left(1 + \frac{r}{n}\right)^n}\\
                                                  & =  e^{\lim_{n \to \infty}n*\ln\left(1 + \frac{r}{n}\right)}.
           \end{align*}
           
Now we will evaluate:
     \begin{align*}
          \lim_{n \to \infty}n*\ln\left(1 + \frac{r}{n}\right) & = \lim_{x \to 0}\frac{1}{x}*\ln\left(1 + r * x\right)\\
               & = \lim_{x \to 0}\frac{\ln\left(1 + r * x\right)}{x}
     \end{align*}
Then we use L'H\^opital's rule (0/0 form \ldots):
      \begin{align*}
          \lim_{x \to 0}\frac{\ln\left(1 + r * x\right)}{x} & = \lim_{x \to 0}\frac{\frac{1}{1 + r * x} * r}{1} \\
                         & = r.
     \end{align*} 
     
\pagedone
 
Thus, putting all the pieces together, we have that, under continuous compounding at nominal interest rate $r$,
at the end of one year, the account will have
     $$P_{new} = P_{orig} * e^r$$
and the effective interest rate will be
     $$r_{eff} = e^r - 1.$$
With a bit more thinking, we can see that if a customer wants to withdraw their money after time $t$ (in units of years),
they should get:
     $$P_{new}(t) = P_{orig} * e^{rt}.$$
     
\pagedone
\exercises{Interest}
     \begin{enumerate}
          \item We have played somewhat fast and loose with {\em limits} and {\em exponentials} and {\em logs}.  Were all the steps
                   legitimate?
         \item Why did I shift from $\lim_{n \to \infty}$ to $\lim_{x \to 0}$ in the middle of my calculation?
          \item Could we have come to the same conclusion (exponentials) in some other way (e.g., solving a differential equation)?
          \item More metaphysically, why does the {\em exponential} show up here?
     \end{enumerate}
     
\pagedone
% \footnotesize
% \bibliographystyle{plain} 
% 
%
%
%\marginpar{\hyperlink{Contents}{\hfil$\leftarrow$}}
%
%\vspace{-\baselineskip}
%\vspace{-\baselineskip}
%\vspace{-\baselineskip}
% 
% \begin{thebibliography}{12}
%
%\addcontentsline{toc}{section}{References}
%
%
%
%\bibitem{baryam}
%Bar-Yam, Yaneer,\newline
%{\em Dynamics of Complex Systems (Studies in Nonlinearity) },
%Westview Press, Boulder, 1997.
%
%
%
%
%
%\end{thebibliography}
%
%\hyperlink{Contents}{\hfil To top $\leftarrow$}


\end{document}
