day2/session5.tex
author Santosh G. Vattam <vattam.santosh@gmail.com>
Wed, 21 Apr 2010 13:47:36 +0530
changeset 384 9f9fddf7e37c
parent 378 2299700a8b97
child 385 c70118cdde66
permissions -rw-r--r--
MNIT Jaipur changes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
%Tutorial slides on Python.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
%
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
% Copyright (c) 2005-2009, Prabhu Ramachandran
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    15
\mode<presentation>
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
{
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    17
  \usetheme{Warsaw}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    18
  \useoutertheme{infolines}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    21
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
\usepackage[english]{babel}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    24
%\usepackage{times}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    26
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    27
% Taken from Fernando's slides.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    31
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    32
\definecolor{darkgreen}{rgb}{0,0.5,0}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    33
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    34
\usepackage{listings}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    35
\lstset{language=Python,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
    basicstyle=\ttfamily\bfseries,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
    commentstyle=\color{red}\itshape,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    38
  stringstyle=\color{darkgreen},
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
  showstringspaces=false,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    40
  keywordstyle=\color{blue}\bfseries}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    41
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    43
% Macros
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    44
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    45
\newcommand{\emphbar}[1]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    46
{\begin{beamercolorbox}[rounded=true]{emphbar} 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    47
      {#1}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    48
 \end{beamercolorbox}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    49
}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    50
\newcounter{time}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    51
\setcounter{time}{0}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    52
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    53
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    54
\newcommand{\typ}[1]{\texttt{#1}}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    55
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    56
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    57
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    58
%%% This is from Fernando's setup.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    59
% \usepackage{color}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    60
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    61
% % Use and configure listings package for nicely formatted code
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    62
% \usepackage{listings}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    63
% \lstset{
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    64
%    language=Python,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    65
%    basicstyle=\small\ttfamily,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    66
%    commentstyle=\ttfamily\color{blue},
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    67
%    stringstyle=\ttfamily\color{orange},
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    68
%    showstringspaces=false,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    69
%    breaklines=true,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    70
%    postbreak = \space\dots
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    71
% }
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    72
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    73
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    75
% Title page
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    76
\title[Exercises]{Exercises}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    77
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    78
\author[FOSSEE] {FOSSEE}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    79
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    80
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
384
9f9fddf7e37c MNIT Jaipur changes.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
    81
\date[] {03 April, 2010\\Day 2, Session 5}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    83
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    86
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    87
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    89
%% the beginning of each subsection:
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    90
\AtBeginSubsection[]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    91
{
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    92
  \begin{frame}<beamer>
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    93
    \frametitle{Outline}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    95
  \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    96
}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    97
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    98
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    99
% If you wish to uncover everything in a step-wise fashion, uncomment
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   100
% the following command: 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   101
%\beamerdefaultoverlayspecification{<+->}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   102
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   103
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   104
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   105
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   106
% DOCUMENT STARTS
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   107
\begin{document}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   108
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   109
\begin{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   110
  \titlepage
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   111
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   112
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   113
\begin{frame}{Problem 1.1}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   114
  The aliquot of a number is defined as: the sum of the \emph{proper} divisors of the number. For example:\\
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   115
aliquot(12) = 1 + 2 + 3 + 4 + 6 = 16.\\
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   116
  Write a function that returns the aliquot number of a given number. 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   117
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   118
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   119
\begin{frame}{Problem 1.2}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   120
  Pair of numbers (a, b) is said to be \alert{amicable} if aliquot number of a is b and aliquot number of b is a.\\
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   121
  Example: \texttt{220, 284}\\
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   122
  Write a program that prints all four digit amicable pairs.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   123
  
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   124
\inctime{20}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   125
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   126
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   127
%% \begin{frame}{Problem 2}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   128
%%   Given an empty chessboard and one Bishop placed in any s%quare, say (r, c), generate the list of all squares the Bi%shop could move to.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   129
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   130
%% \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   131
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   132
\begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   133
  \frametitle{Problem 2}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   134
  Given a string of numbers like, ``1, 3-7, 12, 15, 18-21'', produce the following list \\
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   135
  \begin{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   136
    [1,3,4,5,6,7,12,15,18,19,20,21]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   137
  \end{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   138
\inctime{10}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   139
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   140
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   141
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   142
\begin{frame}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   143
  \frametitle{Problem 3}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   144
Given a list of words, find all the anagrams in the list.
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   145
Solve the problem without using dictionaries.
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   146
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   147
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   148
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   149
\begin{frame} 
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   150
  \frametitle{Problem 4}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 347
diff changeset
   151
  Count frequencies of words in a file named 'holmes.txt'.
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   152
\inctime{25}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   153
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   154
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   155
\begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   156
  \frametitle{Problem set 4}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   157
  Central difference
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   158
  \begin{equation*}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   159
  \frac{sin(x+h)-sin(x-h)}{2h}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   160
  \end{equation*}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   161
  \begin{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   162
  In []: x = linspace(0, 2*pi, 100)
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   163
  In []: y = sin(x)
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   164
  In []: deltax = x[1] - x[0]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   165
  \end{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   166
  \pause
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   167
    \begin{enumerate}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   168
      \item Given this, get the finite difference of sin in the range 0 to 2*pi
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   169
    \end{enumerate}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   170
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   171
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   172
\begin{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   173
  \frametitle{Problem Set 5}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   174
  \begin{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   175
      \item[5.1] Write a function that plots any regular n-gon given \typ{n}.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   176
      \item[5.2] Consider the logistic map, $f(x) = kx(1-x)$, plot it for
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   177
          $k=2.5, 3.5$ and $4$ in the same plot.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   178
\end{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   179
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   180
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   181
\begin{frame}[fragile] 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   182
\frametitle{Problem Set 5}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   183
  \begin{columns}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   184
    \column{0.6\textwidth}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   185
    \small{
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   186
    \begin{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   187
      \item[3] Consider the iteration $x_{n+1} = f(x_n)$ where $f(x) = kx(1-x)$.  Plot the successive iterates of this process as explained below. 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   188
    \end{itemize}}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   189
    \column{0.35\textwidth}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   190
    \hspace*{-0.5in}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   191
  \includegraphics[height=1.6in, interpolate=true]{data/cobweb}  
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   192
\end{columns}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   193
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   194
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   195
\begin{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   196
  \frametitle{Problem Set 5.3}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   197
  Plot the cobweb plot as follows:
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   198
  \begin{enumerate}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   199
    \item Start at $(x_0, 0)$ ($\implies$ i=0)
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   200
    \item Draw a line to $(x_i, f(x_i))$
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   201
    \item Set $x_{i+1} = f(x_i)$
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   202
    \item Draw a line to $(x_{i+1}, x_{i+1})$
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   203
    \item $(i\implies i+1)$ 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   204
    \item Repeat from 2 for as long as you want 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   205
  \end{enumerate}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   206
\inctime{20}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   207
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   208
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   209
\end{document}