day2/session2.tex
author Puneeth Chaganti <punchagan@fossee.in>
Tue, 06 Oct 2009 18:35:47 +0530
changeset 41 64177498937a
parent 37 d5b7be72693b
child 46 63704b5650f1
permissions -rw-r--r--
Added time counter increments to day2 session2.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
% Tutorial slides on Python.
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
%
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
% Copyright (c) 2005-2008, Prabhu Ramachandran
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
\mode<presentation>
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
{
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
  \usetheme{Warsaw}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
  \useoutertheme{split}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
\usepackage[english]{babel}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
%\usepackage{times}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
% Taken from Fernando's slides.
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
\definecolor{darkgreen}{rgb}{0,0.5,0}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
\usepackage{listings}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
\lstset{language=Python,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
    basicstyle=\ttfamily\bfseries,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
    commentstyle=\color{red}\itshape,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
  stringstyle=\color{darkgreen},
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
  showstringspaces=false,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
  keywordstyle=\color{blue}\bfseries}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
% Macros
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
\newcommand{\emphbar}[1]
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
{\begin{beamercolorbox}[rounded=true]{emphbar} 
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
      {#1}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
 \end{beamercolorbox}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
\newcounter{time}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
\setcounter{time}{0}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
    54
\newcommand{\typ}[1]{\lstinline{#1}}
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
%%% This is from Fernando's setup.
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
% \usepackage{color}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
% % Use and configure listings package for nicely formatted code
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
% \usepackage{listings}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
% \lstset{
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
%    language=Python,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
%    basicstyle=\small\ttfamily,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
%    commentstyle=\ttfamily\color{blue},
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
%    stringstyle=\ttfamily\color{orange},
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
%    showstringspaces=false,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
%    breaklines=true,
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
%    postbreak = \space\dots
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
% }
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
% Title page
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
    76
\title[]{Numerical Computing with Numpy \& Scipy}
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
\author[FOSSEE Team] {Asokan Pichai\\Prabhu Ramachandran}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    80
\institute[FOSSEE] {FOSSEE Team}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    81
\date[] {11, October 2009}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
%% the beginning of each subsection:
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
\AtBeginSubsection[]
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
{
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
  \begin{frame}<beamer>
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
    \frametitle{Outline}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
  \end{frame}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    98
\AtBeginSection[]
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
{
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
  \begin{frame}<beamer>
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
    \frametitle{Outline}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
    \tableofcontents[currentsection,currentsubsection]
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
  \end{frame}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
% If you wish to uncover everything in a step-wise fashion, uncomment
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
% the following command: 
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
%\beamerdefaultoverlayspecification{<+->}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
% DOCUMENT STARTS
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   114
\begin{document}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   115
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   116
\begin{frame}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   117
  \maketitle
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   118
\end{frame}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   119
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   120
\begin{frame}[fragile]
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   121
  \frametitle{Broadcasting}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   122
  \begin{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   123
    \item Used so that functions can take inputs that are not of the same shape.
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   124
    \item 2 rules -
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   125
      \begin{enumerate}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   126
      \item 1 (repeatedly) pre-pended to shapes of smaller arrays
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   127
      \item Size 1 in a dimension -> Largest size in that dimension
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   128
      \end{enumerate}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   129
  \end{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   130
  \begin{columns}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   131
    \column{0.65\textwidth}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   132
    \hspace*{-1.5in}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   133
    \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   134
      >>> x = np.arange(4)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   135
      >>> x+3
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   136
      array([3, 4, 5, 6])
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   137
    \end{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   138
    \column{0.35\textwidth}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   139
    \includegraphics[height=0.7in, interpolate=true]{data/broadcast_scalar}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   140
  \end{columns}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   141
\end{frame}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   142
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   143
\begin{frame}[fragile]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   144
  \frametitle{Broadcasting in 3D}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   145
    \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   146
      >>> x = np.zeros((3, 5))
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   147
      >>> y = np.zeros(8)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   148
      >>> (x[..., None] + y).shape
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   149
      (3, 5, 8)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   150
    \end{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   151
    \begin{figure}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   152
      \begin{center}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   153
      \includegraphics[height=1.5in, interpolate=true]{data/array_3x5x8}        
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   154
      \end{center}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   155
    \end{figure}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   156
\end{frame}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   157
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   158
\begin{frame}[fragile]
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   159
  \frametitle{Copies \& Views}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   160
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   161
    >>> a = array([[1,2,3], [4,5,6],     
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   162
                   [7,8,9]])
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   163
    >>> a[0,1:3]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   164
    array([2, 3])
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   165
    >>> a[0::2,0::2]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   166
    array([[1, 3],
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   167
          [7, 9]])
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   168
  \end{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   169
  \begin{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   170
  \item Slicing and Striding just reference the same memory
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   171
  \item They produce views of the data, not copies
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   172
  \end{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   173
\end{frame}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   174
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   175
\begin{frame}[fragile]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   176
  \frametitle{Copies contd \ldots}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   177
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   178
    >>> a[np.array([0,1,2])]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   179
    array([[1, 2, 3],
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   180
           [4, 5, 6],
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   181
           [7, 8, 9]])
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   182
  \end{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   183
  \begin{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   184
  \item Index arrays or Boolean arrays produce copies
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   185
  \end{itemize}
41
64177498937a Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 37
diff changeset
   186
\inctime{15}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   187
\end{frame}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   188
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   189
\begin{frame}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   190
  \frametitle{More Numpy Functions \& Methods}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   191
  More functions
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   192
  \begin{itemize}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   193
    \item \typ{take}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   194
    \item \typ{choose}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   195
    \item \typ{where}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   196
    \item \typ{compress}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   197
    \item \typ{concatenate}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   198
  \end{itemize}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   199
  Ufunc methods 
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   200
  \begin{itemize}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   201
    \item \typ{reduce}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   202
    \item \typ{accumulate}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   203
    \item \typ{outer}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   204
    \item \typ{reduceat}
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   205
  \end{itemize}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   206
\inctime{5}
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   207
\end{frame}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   208
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   209
\begin{frame}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   210
    {Intro to SciPy}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   211
  \begin{itemize}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   212
  \item \url{http://www.scipy.org}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   213
  \item Open source scientific libraries for Python
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   214
  \item Based on NumPy
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   215
    \end{itemize}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   216
\end{frame}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   217
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   218
\begin{frame}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   219
  \frametitle{SciPy}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   220
  \begin{itemize}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   221
  \item Provides:
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   222
    \begin{itemize}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   223
    \item Linear algebra
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   224
    \item Numerical integration
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   225
    \item Fourier transforms
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   226
    \item Signal processing
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   227
    \item Special functions
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   228
    \item Statistics
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   229
    \item Optimization
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   230
    \item Image processing
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   231
    \item ODE solvers
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   232
    \end{itemize}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   233
  \item Uses LAPACK, QUADPACK, ODEPACK, FFTPACK etc. from netlib
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   234
  \end{itemize}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   235
\end{frame}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   236
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   237
\begin{frame}[fragile]
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   238
  \frametitle{Linear Algebra}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   239
  \typ{>>> from scipy import linalg}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   240
  \begin{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   241
    \item \typ{linalg.det, linalg.norm}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   242
    \item \typ{linalg.eig, linalg.lu}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   243
    \item \typ{linalg.expm, linalg.logm}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   244
    \item \typ{linalg.sinm, linalg.sinhm}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   245
  \end{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   246
\end{frame}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   247
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   248
\begin{frame}[fragile]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   249
  \frametitle{Linear Algebra \ldots}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   250
  \begin{align*}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   251
    3x + 2y - z  & = 1 \\
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   252
    2x - 2y + 4z  & = -2 \\
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   253
    -x + \frac{1}{2}y -z & = 0
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   254
  \end{align*}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   255
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   256
    >>> linalg.solve(A,B)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   257
  \end{lstlisting}
41
64177498937a Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 37
diff changeset
   258
\inctime{15}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   259
\end{frame}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   260
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   261
\begin{frame}[fragile]
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   262
  \begin{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   263
    \item Integrating Functions given function object
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   264
    \item Integrating Functions given fixed samples
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   265
    \item Numerical integrators of ODE systems
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   266
  \end{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   267
  \frametitle{Integrate}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   268
  Calculate $\int^1_0sin(x) + x^2$
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   269
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   270
    >>> def f(x):
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   271
            return np.sin(x)+x**2
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   272
    >>> integrate.quad(f, 0, 1)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   273
  \end{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   274
\end{frame}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   275
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   276
\begin{frame}[fragile]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   277
  \frametitle{Integrate \ldots}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   278
  Numerically solve ODEs\\
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   279
  \begin{align*}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   280
  \frac{dx}{dt}&=-e^{(-t)}x^2(t)\\ 
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   281
           x(0)&=2    
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   282
  \end{align*}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   283
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   284
    def dx_dt(x,t):
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   285
        return -np.exp(-t)*x**2
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   286
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   287
    x=integrate.odeint(dx_dt, 2, t)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   288
    plt.plot(x,t)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   289
  \end{lstlisting}
41
64177498937a Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 37
diff changeset
   290
\inctime{10}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   291
\end{frame}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   292
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   293
\begin{frame}[fragile]
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   294
  \frametitle{Interpolation}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   295
  \begin{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   296
    \item \typ{interpolate.interp1d, ...}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   297
    \item \typ{interpolate.splrep, splev}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   298
  \end{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   299
  Cubic Spline of $sin(x)$
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   300
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   301
    x = np.arange(0,2*np.pi,np.pi/8)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   302
    y = np.sin(x)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   303
    t = interpolate.splrep(x,y,s=0)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   304
    X = np.arange(0,2*np.pi,np.pi/50)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   305
    Y = interpolate.splev(X,t,der=0)
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   306
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   307
    plt.plot(x,y,'o',x,y,X,Y)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   308
    plt.show()
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   309
  \end{lstlisting}
41
64177498937a Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 37
diff changeset
   310
\inctime{10}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   311
\end{frame}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   312
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   313
\begin{frame}[fragile]
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   314
  \frametitle{Signal \& Image Processing}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   315
    \begin{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   316
     \item Convolution
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   317
     \item B-splines
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   318
     \item Filtering
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   319
     \item Filter design
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   320
     \item IIR filter design
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   321
     \item Linear Systems
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   322
     \item LTI Reresentations
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   323
     \item Waveforms
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   324
     \item Window functions
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   325
     \item Wavelets
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   326
    \end{itemize}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   327
\end{frame}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   328
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   329
\begin{frame}[fragile]
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   330
  \frametitle{Signal \& Image Processing}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   331
  Applying a simple median filter
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   332
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   333
    from scipy import signal, ndimage
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   334
    from scipy import lena
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   335
    A=lena().astype('float32')
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   336
    B=signal.medfilt2d(A)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   337
    imshow(B)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   338
  \end{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   339
  Zooming an array - uses spline interpolation
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   340
  \begin{lstlisting}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   341
    b=ndimage.zoom(A,0.5)
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   342
    imshow(b)
41
64177498937a Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 37
diff changeset
   343
    \inctime{5}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   344
  \end{lstlisting}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   345
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   346
\end{frame}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   347
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   348
\begin{frame}[fragile]
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   349
  \frametitle{Problems}
37
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   350
  The Van der Pol oscillator is a type of nonconservative oscillator with nonlinear damping. It evolves in time according to the second order differential equation:
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   351
  \begin{equation*}
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   352
  \frac{d^2x}{dt^2}+\mu(x^2-1)\frac{dx}{dt}+x= 0
d5b7be72693b Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 36
diff changeset
   353
  \end{equation*}
41
64177498937a Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 37
diff changeset
   354
\inctime{25}
36
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   355
\end{frame}
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   356
8047755ae660 Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 35
diff changeset
   357
35
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   358
\end{document}
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   359
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   360
- Numpy arrays (30 mins)
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   361
    - Matrices
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   362
    - random number generation.
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   363
    - Image manipulation: jigsaw puzzle.
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   364
    - Monte-carlo integration.
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   365
a49b340696ba Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   366