presentations/solving-equations.tex
changeset 79 3893bac8e424
child 80 94d177078716
equal deleted inserted replaced
78:099a2cc6c7d2 79:3893bac8e424
       
     1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
     2 %Tutorial slides on Python.
       
     3 %
       
     4 % Author: FOSSEE 
       
     5 % Copyright (c) 2009, FOSSEE, IIT Bombay
       
     6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
     7 
       
     8 \documentclass[14pt,compress]{beamer}
       
     9 %\documentclass[draft]{beamer}
       
    10 %\documentclass[compress,handout]{beamer}
       
    11 %\usepackage{pgfpages} 
       
    12 %\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
       
    13 
       
    14 % Modified from: generic-ornate-15min-45min.de.tex
       
    15 \mode<presentation>
       
    16 {
       
    17   \usetheme{Warsaw}
       
    18   \useoutertheme{infolines}
       
    19   \setbeamercovered{transparent}
       
    20 }
       
    21 
       
    22 \usepackage[english]{babel}
       
    23 \usepackage[latin1]{inputenc}
       
    24 %\usepackage{times}
       
    25 \usepackage[T1]{fontenc}
       
    26 
       
    27 % Taken from Fernando's slides.
       
    28 \usepackage{ae,aecompl}
       
    29 \usepackage{mathpazo,courier,euler}
       
    30 \usepackage[scaled=.95]{helvet}
       
    31 
       
    32 \definecolor{darkgreen}{rgb}{0,0.5,0}
       
    33 
       
    34 \usepackage{listings}
       
    35 \lstset{language=Python,
       
    36     basicstyle=\ttfamily\bfseries,
       
    37     commentstyle=\color{red}\itshape,
       
    38   stringstyle=\color{darkgreen},
       
    39   showstringspaces=false,
       
    40   keywordstyle=\color{blue}\bfseries}
       
    41 
       
    42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    43 % Macros
       
    44 \setbeamercolor{emphbar}{bg=blue!20, fg=black}
       
    45 \newcommand{\emphbar}[1]
       
    46 {\begin{beamercolorbox}[rounded=true]{emphbar} 
       
    47       {#1}
       
    48  \end{beamercolorbox}
       
    49 }
       
    50 \newcounter{time}
       
    51 \setcounter{time}{0}
       
    52 \newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
       
    53 
       
    54 \newcommand{\typ}[1]{\lstinline{#1}}
       
    55 
       
    56 \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
       
    57 
       
    58 % Title page
       
    59 \title{Python for Scientific Computing : Least Square Fit}
       
    60 
       
    61 \author[FOSSEE] {FOSSEE}
       
    62 
       
    63 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
       
    64 \date{}
       
    65 
       
    66 % DOCUMENT STARTS
       
    67 \begin{document}
       
    68 
       
    69 \begin{frame}
       
    70   \maketitle
       
    71 \end{frame}
       
    72 
       
    73 \begin{frame}
       
    74   \frametitle{About the Session}
       
    75   \begin{block}{Goal}
       
    76 Finding least square fit of given data-set
       
    77   \end{block}
       
    78   \begin{block}{Checklist}
       
    79     \begin{itemize}
       
    80     \item pendulum.txt
       
    81   \end{itemize}
       
    82   \end{block}
       
    83 \end{frame}
       
    84 
       
    85 \begin{frame}[fragile]
       
    86 \frametitle{Solution of equations}
       
    87 Consider,
       
    88   \begin{align*}
       
    89     3x + 2y - z  & = 1 \\
       
    90     2x - 2y + 4z  & = -2 \\
       
    91     -x + \frac{1}{2}y -z & = 0
       
    92   \end{align*}
       
    93 Solution:
       
    94   \begin{align*}
       
    95     x & = 1 \\
       
    96     y & = -2 \\
       
    97     z & = -2
       
    98   \end{align*}
       
    99 \end{frame}
       
   100 
       
   101 \begin{frame}[fragile]
       
   102 \frametitle{Scipy Methods - \typ{roots}}
       
   103 \begin{itemize}
       
   104 \item Calculates the roots of polynomials
       
   105 \item To calculate the roots of $x^2-5x+6$ 
       
   106 \end{itemize}
       
   107 \begin{lstlisting}
       
   108   In []: coeffs = [1, -5, 6]
       
   109   In []: roots(coeffs)
       
   110   Out[]: array([3., 2.])
       
   111 \end{lstlisting}
       
   112 \vspace*{-.2in}
       
   113 \begin{center}
       
   114 \includegraphics[height=1.6in, interpolate=true]{data/roots}    
       
   115 \end{center}
       
   116 \end{frame}
       
   117 
       
   118 \begin{frame}[fragile]
       
   119 \frametitle{Scipy Methods - \typ{fsolve}}
       
   120 \begin{small}
       
   121 \begin{lstlisting}
       
   122   In []: from scipy.optimize import fsolve
       
   123 \end{lstlisting}
       
   124 \end{small}
       
   125 \begin{itemize}
       
   126 \item Finds the roots of a system of non-linear equations
       
   127 \item Input arguments - Function and initial estimate
       
   128 \item Returns the solution
       
   129 \end{itemize}
       
   130 \end{frame}
       
   131 
       
   132 \begin{frame}[fragile]
       
   133   \frametitle{Summary}
       
   134   \begin{block}{}
       
   135     \begin{itemize}
       
   136     \item Solving linear equations
       
   137     \item Finding roots
       
   138     \item Roots of non linear equations
       
   139     \item Basics of Functions
       
   140     \end{itemize}
       
   141   \end{block}    
       
   142 \end{frame}
       
   143 
       
   144 \begin{frame}
       
   145   \frametitle{Thank you!}  
       
   146   \begin{block}{}
       
   147   This session is part of \textcolor{blue}{FOSSEE} project funded by:
       
   148   \begin{center}
       
   149     \textcolor{blue}{NME through ICT from MHRD, Govt. of India}.
       
   150   \end{center}  
       
   151   \end{block}
       
   152 \end{frame}
       
   153 
       
   154 \end{document}