presentations/ode.tex
author asokan <asokan@fossee.in>
Tue, 18 May 2010 15:40:17 +0530
changeset 126 2eac725a5766
parent 90 314a711c042f
permissions -rw-r--r--
changes to array.txt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     2
%Tutorial slides on Python.
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     3
%
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     4
% Author: FOSSEE 
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     5
% Copyright (c) 2009, FOSSEE, IIT Bombay
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
\mode<presentation>
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
{
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
  \usetheme{Warsaw}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    18
  \useoutertheme{infolines}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
\usepackage[english]{babel}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    24
%\usepackage{times}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
% Taken from Fernando's slides.
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
\definecolor{darkgreen}{rgb}{0,0.5,0}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
\usepackage{listings}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
\lstset{language=Python,
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
    basicstyle=\ttfamily\bfseries,
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
    commentstyle=\color{red}\itshape,
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    38
  stringstyle=\color{darkgreen},
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
  showstringspaces=false,
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
  keywordstyle=\color{blue}\bfseries}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    43
% Macros
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
\newcommand{\emphbar}[1]
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
{\begin{beamercolorbox}[rounded=true]{emphbar} 
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
      {#1}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
 \end{beamercolorbox}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
\newcounter{time}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
\setcounter{time}{0}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    52
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    54
\newcommand{\typ}[1]{\lstinline{#1}}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    55
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    56
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    58
% Title page
86
a63a14de8584 Minor edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 85
diff changeset
    59
\title{Python for Scientific Computing: Ordinary Differential Equation}
85
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
\author[FOSSEE] {FOSSEE}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    62
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    63
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    64
\date{}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    65
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    66
% DOCUMENT STARTS
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    67
\begin{document}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    68
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    69
\begin{frame}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    70
  \maketitle
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    71
\end{frame}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    72
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    73
\begin{frame}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    74
  \frametitle{About the Session}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    75
  \begin{block}{Goal}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    76
Solving ordinary differential equations.
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    77
  \end{block}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    78
  \begin{block}{Prerequisite}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    79
    \begin{itemize}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    80
    \item Understanding of Arrays.
87
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    81
    \item functions and lists
85
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    82
    \end{itemize}    
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    83
  \end{block}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    84
\end{frame}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    85
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    86
\begin{frame}[fragile]
87
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    87
\frametitle{Solving ODEs using SciPy}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    88
\begin{itemize}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    89
\item Let's consider the spread of an epidemic in a population
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    90
\item $\frac{dy}{dt} = ky(L-y)$ gives the spread of the disease
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    91
\item L is the total population.
90
314a711c042f Finished ode presentation.
Shantanu <shantanu@fossee.in>
parents: 87
diff changeset
    92
\item Use L = 250000, k = 0.00003, y(0) = 250
87
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    93
\end{itemize}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    94
\end{frame}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    95
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    96
\begin{frame}[fragile]
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    97
\frametitle{ODEs - Simple Pendulum}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    98
We shall use the simple ODE of a simple pendulum. 
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
    99
\begin{equation*}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   100
\ddot{\theta} = -\frac{g}{L}sin(\theta)
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   101
\end{equation*}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   102
\begin{itemize}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   103
\item This equation can be written as a system of two first order ODEs
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   104
\end{itemize}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   105
\begin{align}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   106
\dot{\theta} &= \omega \\
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   107
\dot{\omega} &= -\frac{g}{L}sin(\theta) \\
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   108
 \text{At}\ t &= 0 : \nonumber \\
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   109
 \theta = \theta_0(10^o)\quad & \&\quad  \omega = 0\ (Initial\ values)\nonumber 
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   110
\end{align}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   111
\end{frame}
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   112
62be6012121f Added changes to ode presentation.
Shantanu <shantanu@fossee.in>
parents: 86
diff changeset
   113
\begin{frame}[fragile]
85
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   114
  \frametitle{Summary}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   115
  \begin{block}{}
86
a63a14de8584 Minor edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 85
diff changeset
   116
    Solving ordinary differential equations
a63a14de8584 Minor edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 85
diff changeset
   117
  \end{block}
85
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   118
\end{frame}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   119
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   120
\begin{frame}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   121
  \frametitle{Thank you!}  
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   122
  \begin{block}{}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   123
  This session is part of \textcolor{blue}{FOSSEE} project funded by:
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   124
  \begin{center}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   125
    \textcolor{blue}{NME through ICT from MHRD, Govt. of India}.
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   126
  \end{center}  
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   127
  \end{block}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   128
\end{frame}
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   129
74d913293f7d Added ode presentation.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   130
\end{document}