day1/session4.tex
author Puneeth Chaganti <punchagan@fossee.in>
Mon, 26 Oct 2009 12:46:02 +0530
changeset 168 971794400d10
parent 141 fccf675946bf
child 172 72bd110ab42f
permissions -rw-r--r--
Added image files for least square fit.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     2
%Tutorial slides on Python.
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     3
%
141
fccf675946bf Made usage of FOSSEE consistent; removed all instances of Team, Group.
Puneeth Chaganti <punchagan@fossee.in>
parents: 131
diff changeset
     4
% Author: FOSSEE 
fccf675946bf Made usage of FOSSEE consistent; removed all instances of Team, Group.
Puneeth Chaganti <punchagan@fossee.in>
parents: 131
diff changeset
     5
% Copyright (c) 2009, FOSSEE, IIT Bombay
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     7
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    13
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    15
\mode<presentation>
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    16
{
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    17
  \usetheme{Warsaw}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    18
  \useoutertheme{split}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    20
}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    21
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    22
\usepackage[english]{babel}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    24
%\usepackage{times}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
    26
\usepackage{amsmath}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    27
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    28
% Taken from Fernando's slides.
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    29
\usepackage{ae,aecompl}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    30
\usepackage{mathpazo,courier,euler}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    31
\usepackage[scaled=.95]{helvet}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    32
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    33
\definecolor{darkgreen}{rgb}{0,0.5,0}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    34
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    35
\usepackage{listings}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    36
\lstset{language=Python,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    37
    basicstyle=\ttfamily\bfseries,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    38
    commentstyle=\color{red}\itshape,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    39
  stringstyle=\color{darkgreen},
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    40
  showstringspaces=false,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    41
  keywordstyle=\color{blue}\bfseries}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    42
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    44
% Macros
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    45
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    46
\newcommand{\emphbar}[1]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    47
{\begin{beamercolorbox}[rounded=true]{emphbar} 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    48
      {#1}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    49
 \end{beamercolorbox}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    50
}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    51
\newcounter{time}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    52
\setcounter{time}{0}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    53
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    54
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
    55
\newcommand{\typ}[1]{\lstinline{#1}}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    56
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    57
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    58
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    59
%%% This is from Fernando's setup.
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    60
% \usepackage{color}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    61
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    62
% % Use and configure listings package for nicely formatted code
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    63
% \usepackage{listings}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    64
% \lstset{
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    65
%    language=Python,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    66
%    basicstyle=\small\ttfamily,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    67
%    commentstyle=\ttfamily\color{blue},
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    68
%    stringstyle=\ttfamily\color{orange},
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    69
%    showstringspaces=false,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    70
%    breaklines=true,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    71
%    postbreak = \space\dots
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    72
% }
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    73
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    74
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    75
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    76
% Title page
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    77
\title[Basic Python]{Matrices, Solution of equations and Integration\\}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    78
141
fccf675946bf Made usage of FOSSEE consistent; removed all instances of Team, Group.
Puneeth Chaganti <punchagan@fossee.in>
parents: 131
diff changeset
    79
\author[FOSSEE] {FOSSEE}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    80
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    81
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    82
\date[] {31, October 2009\\Day 1, Session 4}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    83
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    84
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    85
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    86
%\logo{\pgfuseimage{iitmlogo}}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    87
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    88
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    89
%% Delete this, if you do not want the table of contents to pop up at
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    90
%% the beginning of each subsection:
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    91
\AtBeginSubsection[]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    92
{
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    93
  \begin{frame}<beamer>
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    94
    \frametitle{Outline}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    95
    \tableofcontents[currentsection,currentsubsection]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    96
  \end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    97
}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    98
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    99
%%\AtBeginSection[]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   100
%%{
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   101
  %%\begin{frame}<beamer>
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   102
%%    \frametitle{Outline}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   103
  %%  \tableofcontents[currentsection,currentsubsection]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   104
  %%\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   105
%%}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   106
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   107
% If you wish to uncover everything in a step-wise fashion, uncomment
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   108
% the following command: 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   109
%\beamerdefaultoverlayspecification{<+->}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   110
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   111
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   112
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   113
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   114
% DOCUMENT STARTS
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   115
\begin{document}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   116
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   117
\begin{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   118
  \titlepage
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   119
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   120
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   121
\begin{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   122
  \frametitle{Outline}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   123
  \tableofcontents
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   124
%  \pausesections
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   125
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   126
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   127
\section{Matrices}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   128
\subsection{Initializing}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   129
\begin{frame}[fragile]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   130
\frametitle{Matrices: Initializing}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   131
\begin{lstlisting}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   132
  In []: a = matrix([[1,2,3],
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   133
                     [4,5,6],
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   134
                     [7,8,9]])
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   135
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   136
  In []: a
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   137
  Out[]: 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   138
  matrix([[1, 2, 3],
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   139
         [4, 5, 6],
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   140
         [7, 8, 9]])
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   141
\end{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   142
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   143
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   144
\subsection{Basic Operations}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   145
\begin{frame}[fragile]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   146
\frametitle{Inverse of a Matrix}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   147
\begin{small}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   148
\begin{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   149
  In []: linalg.inv(a)
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   150
  Out[]: 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   151
  matrix([[  3.15221191e+15,  -6.30442381e+15,   3.15221191e+15],
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   152
          [ -6.30442381e+15,   1.26088476e+16,  -6.30442381e+15],
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   153
          [  3.15221191e+15,  -6.30442381e+15,   3.15221191e+15]])
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   154
\end{lstlisting}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   155
\end{small}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   156
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   157
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   158
\begin{frame}[fragile]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   159
\frametitle{Determinant}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   160
\begin{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   161
  In []: linalg.det(a)
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   162
  Out[]: -9.5171266700777579e-16
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   163
\end{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   164
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   165
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   166
\begin{frame}[fragile]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   167
\frametitle{Computing Norms}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   168
\begin{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   169
  In []: linalg.norm(a)
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   170
  Out[]: 16.881943016134134
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   171
\end{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   172
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   173
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   174
\begin{frame}[fragile]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   175
\frametitle{Eigen Values and Eigen Matrix}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   176
\begin{small}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   177
\begin{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   178
  In []: linalg.eigvals(a)
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   179
  Out[]: array([  1.61168440e+01,  -1.11684397e+00,  -1.22196337e-15])
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   180
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   181
  In []: linalg.eig(a)
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   182
  Out[]: 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   183
  (array([  1.61168440e+01,  -1.11684397e+00,  -1.22196337e-15]),
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   184
   matrix([[-0.23197069, -0.78583024,  0.40824829],
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   185
          [-0.52532209, -0.08675134, -0.81649658],
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   186
          [-0.8186735 ,  0.61232756,  0.40824829]]))
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   187
\end{lstlisting}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   188
\end{small}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   189
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   190
121
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   191
\section{Solving linear equations}
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   192
\begin{frame}[fragile]
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   193
\frametitle{Solution of equations}
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   194
Example problem: Consider the set of equations
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   195
\vspace{-0.1in}
121
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   196
  \begin{align*}
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   197
    3x + 2y - z  & = 1 \\
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   198
    2x - 2y + 4z  & = -2 \\
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   199
    -x + \frac{1}{2}y -z & = 0
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   200
  \end{align*}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   201
\vspace{-0.08in}
121
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   202
  To Solve this, 
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   203
  \begin{lstlisting}
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   204
    In []: A = array([[3,2,-1],[2,-2,4],[-1, 0.5, -1]])
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   205
    In []: b = array([1, -2, 0])
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   206
    In []: x = linalg.solve(A, b)
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   207
    In []: Ax = dot(A, x)
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   208
    In []: allclose(Ax, b)
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   209
    Out[]: True
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   210
  \end{lstlisting}
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   211
\end{frame}
ac715f4826f2 Update session4.tex with Linear equations slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 118
diff changeset
   212
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   213
\section{Integration}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   214
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   215
\subsection{ODEs}
124
d43a698712e0 Manual merge with mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 123 121
diff changeset
   216
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   217
\begin{frame}[fragile]
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   218
\frametitle{ODE Integration}
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   219
We shall use the simple ODE of a simple pendulum. 
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   220
\begin{equation*}
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   221
\ddot{\theta} = -\frac{g}{L}sin(\theta)
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   222
\end{equation*}
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   223
\begin{itemize}
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   224
\item This equation can be written as a system of two first order ODEs
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   225
\end{itemize}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   226
\begin{align}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   227
\dot{\theta} &= \omega \\
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   228
\dot{\omega} &= -\frac{g}{L}sin(\theta) \\
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   229
 \text{At}\ t &= 0 : \nonumber \\
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   230
 \theta = \theta_0\quad & \&\quad  \omega = 0 \nonumber
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   231
\end{align}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   232
\end{frame}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   233
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   234
\begin{frame}[fragile]
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   235
\frametitle{Solving ODEs using SciPy}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   236
\begin{itemize}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   237
\item We use the \typ{odeint} function from scipy to do the integration
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   238
\item Define a function as below
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   239
\end{itemize}
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   240
\begin{lstlisting}
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   241
In []: def pend_int(unknown, t, p):
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   242
  ....     theta, omega = unknown
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   243
  ....     g, L = p
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   244
  ....     f=[omega, -(g/L)*sin(theta)]
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   245
  ....     return f
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   246
  ....
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   247
\end{lstlisting}
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   248
\end{frame}
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   249
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   250
\begin{frame}[fragile]
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   251
\frametitle{Solving ODEs using SciPy \ldots}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   252
\begin{itemize}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   253
\item \typ{t} is the time variable \\ 
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   254
\item \typ{p} has the constants \\
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   255
\item \typ{initial} has the initial values
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   256
\end{itemize}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   257
\begin{lstlisting}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   258
In []: t = linspace(0, 10, 101)
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   259
In []: p=(-9.81, 0.2)
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   260
In []: initial = [10*2*pi/360, 0]
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   261
\end{lstlisting}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   262
\end{frame}
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   263
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   264
\begin{frame}[fragile]
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   265
\frametitle{Solving ODEs using SciPy \ldots}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   266
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   267
\small{\typ{In []: from scipy.integrate import odeint}}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   268
\begin{lstlisting}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   269
In []: pend_sol = odeint(pend_int, 
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   270
                         initial,t, 
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   271
                         args=(p,))
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   272
\end{lstlisting}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   273
\end{frame}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   274
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   275
\subsection{Quadrature}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   276
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   277
\begin{frame}[fragile]
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   278
\frametitle{Quadrature}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   279
Calculate the area under $(sin(x) + x^2)$ in the range $(0,1)$
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   280
\small{\typ{In []: from scipy.integrate import quad}}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   281
  \begin{lstlisting}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   282
In []: f(x):
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   283
        return sin(x)+x**2
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   284
In []: integrate.quad(f, 0, 1)
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   285
  \end{lstlisting}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   286
\end{frame}
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   287
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   288
\end{document}
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   289