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