%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Tutorial slides on Python.
%
% Author: FOSSEE 
% Copyright (c) 2009, FOSSEE, IIT Bombay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[14pt,compress]{beamer}
%\documentclass[draft]{beamer}
%\documentclass[compress,handout]{beamer}
%\usepackage{pgfpages} 
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]

% Modified from: generic-ornate-15min-45min.de.tex
\mode<presentation>
{
  \usetheme{Warsaw}
  \useoutertheme{infolines}
  \setbeamercovered{transparent}
}

\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
%\usepackage{times}
\usepackage[T1]{fontenc}

% Taken from Fernando's slides.
\usepackage{ae,aecompl}
\usepackage{mathpazo,courier,euler}
\usepackage[scaled=.95]{helvet}

\definecolor{darkgreen}{rgb}{0,0.5,0}

\usepackage{listings}
\lstset{language=Python,
    basicstyle=\ttfamily\bfseries,
    commentstyle=\color{red}\itshape,
  stringstyle=\color{darkgreen},
  showstringspaces=false,
  keywordstyle=\color{blue}\bfseries}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
\newcommand{\emphbar}[1]
{\begin{beamercolorbox}[rounded=true]{emphbar} 
      {#1}
 \end{beamercolorbox}
}
\newcounter{time}
\setcounter{time}{0}
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}

\newcommand{\typ}[1]{\lstinline{#1}}

\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }

% Title page
\title{Python for Scientific Computing : Functions}

\author[FOSSEE] {FOSSEE}

\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
\date{}

% DOCUMENT STARTS
\begin{document}

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

\begin{frame}
  \frametitle{About the Session}
  \begin{block}{Functions in Python}
    \begin{itemize}
    \item Function definition
    \item Function call
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Functions: default arguments}
  \begin{lstlisting}
In []: greet = 'hello world'

In []: greet.split()
Out[]: ['hello', 'world']

In []: line = 'Rossum, Guido, 54, 46, 55'

In []: line.split(',')
Out[]: ['Rossum', ' Guido', ' 54',
                        ' 46', ' 55']
  \end{lstlisting}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Functions: Keyword arguments}
We have seen the following
\begin{lstlisting}
legend(['sin(2y)'], loc = 'center')

plot(y, sin(y), 'g', linewidth = 2)

annotate('local max', xy = (1.5, 1))

pie(science.values(), 
            labels = science.keys())
  \end{lstlisting}
\end{frame}

\begin{frame}
  \frametitle{Summary}
  \begin{itemize}
      \item The \typ{def} keyword
      \item Docstrings
      \item Function arguments
        \begin{itemize}
        \item Default arguments
        \item Keyword arguments
        \end{itemize}
      \item Return values
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Thank you!}  
  \begin{block}{}
  This session is part of \textcolor{blue}{FOSSEE} project funded by:
  \begin{center}
    \textcolor{blue}{NME through ICT from MHRD, Govt. of India}.
  \end{center}  
  \end{block}
\end{frame}

\end{document}
