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