day1/session6.tex
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 21 Oct 2009 16:57:28 +0530
changeset 137 4dea7c5e1bf5
parent 133 578db74dfea0
child 141 fccf675946bf
permissions -rw-r--r--
Minor Typo edits.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
133
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
% Tutorial slides on Python.
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
%
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
% Copyright (c) 2005-2009, Prabhu Ramachandran
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
\mode<presentation>
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
{
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
  \usetheme{Warsaw}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
  \useoutertheme{split}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
\usepackage[english]{babel}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
%\usepackage{times}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
% Taken from Fernando's slides.
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
\usepackage{amsmath}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
\definecolor{darkgreen}{rgb}{0,0.5,0}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
\usepackage{listings}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
\lstset{language=Python,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
    basicstyle=\ttfamily\bfseries,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
    commentstyle=\color{red}\itshape,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
  stringstyle=\color{darkgreen},
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
  showstringspaces=false,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
  keywordstyle=\color{blue}\bfseries}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
% Macros
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
\newcommand{\emphbar}[1]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
{\begin{beamercolorbox}[rounded=true]{emphbar} 
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
      {#1}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
 \end{beamercolorbox}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
\newcounter{time}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
\setcounter{time}{0}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
\newcommand{\typ}[1]{\lstinline{#1}}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
%%% This is from Fernando's setup.
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
% \usepackage{color}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
% % Use and configure listings package for nicely formatted code
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
% \usepackage{listings}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
% \lstset{
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
%    language=Python,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
%    basicstyle=\small\ttfamily,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
%    commentstyle=\ttfamily\color{blue},
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
%    stringstyle=\ttfamily\color{orange},
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
%    showstringspaces=false,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
%    breaklines=true,
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
%    postbreak = \space\dots
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
% }
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
% Title page
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    76
\title[]{Finding Roots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
\author[FOSSEE] {FOSSEE}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    80
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    81
\date[] {31, October 2009\\Day 1, Session 6}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
%% the beginning of each subsection:
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
\AtBeginSubsection[]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
{
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
  \begin{frame}<beamer>
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
    \frametitle{Outline}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
  \end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    98
\AtBeginSection[]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
{
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
  \begin{frame}<beamer>
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
    \frametitle{Outline}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
    \tableofcontents[currentsection,currentsubsection]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
  \end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
% If you wish to uncover everything in a step-wise fashion, uncomment
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
% the following command: 
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
%\beamerdefaultoverlayspecification{<+->}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
% DOCUMENT STARTS
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   114
\begin{document}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   115
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   116
\begin{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   117
  \maketitle
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   118
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   119
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   120
%% \begin{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   121
%%   \frametitle{Outline}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   122
%%   \tableofcontents
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   123
%%   % You might wish to add the option [pausesections]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   124
%% \end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   125
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   126
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   127
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   128
\frametitle{Roots of $f(x)=0$}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   129
\begin{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   130
\item Roots --- values of $x$ satisfying $f(x)=0$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   131
\item $f(x)=0$ may have real or complex roots
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   132
\item Presently, let's look at real roots
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   133
\end{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   134
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   135
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   136
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   137
\frametitle{Initial Estimates}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   138
\begin{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   139
\item Find the roots of $cosx-x^2$ between $-\pi/2$ and $\pi/2$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   140
\item We shall use a crude method to get an initial estimate first
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   141
\end{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   142
\begin{enumerate}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   143
\item Check for change of signs of $f(x)$ in the given interval
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   144
\item A root lies in the interval where the sign change occurs
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   145
\end{enumerate}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   146
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   147
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   148
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   149
\frametitle{Initial Estimates \ldots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   150
\begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   151
  In []: def our_f(x):
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   152
   ....:     return cos(x)-x**2
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   153
   ....: 
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   154
  In []: x = linspace(-pi/2, pi/2, 11)
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   155
\end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   156
\begin{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   157
\item Get the intervals of x, where sign changes occur
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   158
\end{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   159
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   160
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   161
%% \begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   162
%% \frametitle{Initial Estimates \ldots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   163
%% \begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   164
%% In []: pos = y[:-1]*y[1:] < 0
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   165
%% In []: rpos = zeros(x.shape, dtype=bool)
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   166
%% In []: rpos[:-1] = pos
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   167
%% In []: rpos[1:] += pos
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   168
%% In []: rts = x[rpos]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   169
%% \end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   170
%% \end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   171
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   172
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   173
\frametitle{Fixed Point Method}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   174
\begin{enumerate}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   175
\item Convert $f(x)=0$ to the form $x=g(x)$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   176
\item Start with an initial value of $x$ and iterate successively
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   177
\item $x_{n+1}=g(x_n)$ and $x_0$ is our initial guess
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   178
\item Iterate until $x_{n+1}-x_n \le tolerance$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   179
\end{enumerate}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   180
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   181
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   182
%% \begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   183
%% \frametitle{Fixed Point \dots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   184
%% \begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   185
%% In []: def our_g(x):
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   186
%%  ....:     return sqrt(cos(x))
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   187
%%  ....: 
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   188
%% In []: tolerance = 1e-5
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   189
%% In []: while abs(x1-x0)>tolerance:
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   190
%%  ....:     x0 = x1
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   191
%%  ....:     x1 = our_g(x1)
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   192
%%  ....:   
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   193
%% In []: x0
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   194
%% \end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   195
%% \end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   196
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   197
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   198
\frametitle{Bisection Method}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   199
\begin{enumerate}
137
4dea7c5e1bf5 Minor Typo edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 133
diff changeset
   200
\item Start with an interval $(a, b)$ within which a root exists
133
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   201
\item $f(a)\cdot f(b) < 0$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   202
\item Bisect the interval. $c = \frac{a+b}{2}$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   203
\item Change the interval to $(a, c)$ if $f(a)\cdot f(c) < 0$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   204
\item Else, change the interval to $(c, b)$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   205
\item Go back to 3 until $(b-a) \le$ tolerance
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   206
\end{enumerate}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   207
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   208
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   209
%% \begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   210
%% \frametitle{Bisection \dots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   211
%% \begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   212
%% In []: tolerance = 1e-5
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   213
%% In []: a = -pi/2
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   214
%% In []: b = 0
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   215
%% In []: while b-a > tolerance:
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   216
%%  ....:     c = (a+b)/2
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   217
%%  ....:     if our_f(a)*our_f(c) < 0:
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   218
%%  ....:         b = c
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   219
%%  ....:     else:
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   220
%%  ....:         a = c
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   221
%%  ....:         
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   222
%% \end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   223
%% \end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   224
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   225
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   226
\frametitle{Newton Raphson Method}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   227
\begin{enumerate}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   228
\item Start with an initial guess of x for the root
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   229
\item $\Delta x = -f(x)/f^{'}(x)$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   230
\item $ x \leftarrow x + \Delta x$
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   231
\item Go back to 2 until $|\Delta x| \le$ tolerance
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   232
\end{enumerate}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   233
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   234
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   235
%% \begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   236
%% \frametitle{Newton Raphson \dots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   237
%% \begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   238
%% In []: def our_df(x):
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   239
%%  ....:     return -sin(x)-2*x
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   240
%%  ....: 
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   241
%% In []: delx = 10*tolerance
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   242
%% In []: while delx > tolerance:
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   243
%%  ....:     delx = -our_f(x)/our_df(x)
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   244
%%  ....:     x = x + delx
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   245
%%  ....:     
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   246
%%  ....:     
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   247
%% \end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   248
%% \end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   249
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   250
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   251
\frametitle{Newton Raphson \ldots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   252
\begin{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   253
\item What if $f^{'}(x) = 0$?
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   254
\item Can you write a better version of the Newton Raphson?
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   255
\item What if the differential is not easy to calculate?
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   256
\item Look at Secant Method
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   257
\end{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   258
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   259
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   260
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   261
\frametitle{Scipy Methods - \typ{roots}}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   262
\begin{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   263
\item Calculates the roots of polynomials
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   264
\item Array of coefficients is the only parameter
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   265
\end{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   266
\begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   267
  In []: coeffs = [1, 6, 13]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   268
  In []: roots(coeffs)
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   269
\end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   270
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   271
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   272
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   273
\frametitle{Scipy Methods - \typ{fsolve}}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   274
\begin{small}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   275
\begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   276
  In []: from scipy.optimize import fsolve
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   277
\end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   278
\end{small}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   279
\begin{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   280
\item Finds the roots of a system of non-linear equations
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   281
\item Input arguments - Function and initial estimate
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   282
\item Returns the solution
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   283
\end{itemize}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   284
\begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   285
  In []: fsolve(our_f, -pi/2)
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   286
\end{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   287
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   288
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   289
\begin{frame}[fragile]
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   290
\frametitle{Scipy Methods \dots}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   291
\small{
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   292
\begin{lstlisting}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   293
In []: from scipy.optimize import fixed_point
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   294
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   295
In []: from scipy.optimize import bisect
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   296
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   297
In []: from scipy.optimize import newton
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   298
\end{lstlisting}}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   299
\end{frame}
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   300
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   301
578db74dfea0 Added Day1 Session6 - Finding Roots.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   302
\end{document}