--- a/day1/session6.tex Tue Mar 23 00:09:50 2010 +0530
+++ b/day1/session6.tex Mon Mar 29 15:55:07 2010 +0530
@@ -78,7 +78,7 @@
\author[FOSSEE] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {08 March, 2010\\Day 1, Session 6}
+\date[] {02 April, 2010\\Day 1, Session 6}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -239,7 +239,7 @@
\begin{frame}[fragile]
\frametitle{\typ{fsolve}}
-Find the root of $sin(x)+cos^2(x)$ nearest to $0$
+Find the root of $sin(z)+cos^2(z)$ nearest to $0$
\vspace{-0.1in}
\begin{center}
\includegraphics[height=2.8in, interpolate=true]{data/fsolve}
@@ -248,18 +248,18 @@
\begin{frame}[fragile]
\frametitle{\typ{fsolve}}
-Root of $sin(x)+cos^2(x)$ nearest to $0$
+Root of $sin(z)+cos^2(z)$ nearest to $0$
\begin{lstlisting}
-In []: fsolve(sin(x)+cos(x)*cos(x), 0)
-NameError: name 'x' is not defined
+In []: fsolve(sin(z)+cos(z)*cos(z), 0)
+NameError: name 'z' is not defined
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{\typ{fsolve}}
\begin{lstlisting}
-In []: x = linspace(-pi, pi)
-In []: fsolve(sin(x)+cos(x)*cos(x), 0)
+In []: z = linspace(-pi, pi)
+In []: fsolve(sin(z)+cos(z)*cos(z), 0)
\end{lstlisting}
\begin{small}
\alert{\typ{TypeError:}}
@@ -271,8 +271,8 @@
\frametitle{Functions - Definition}
We have been using them all along. Now let's see how to define them.
\begin{lstlisting}
-In []: def f(x):
- return sin(x)+cos(x)*cos(x)
+In []: def f(z):
+ return sin(z)+cos(z)*cos(z)
\end{lstlisting}
\begin{itemize}
\item \typ{def}
@@ -285,7 +285,7 @@
\begin{frame}[fragile]
\frametitle{Functions - Calling them}
\begin{lstlisting}
-In [15]: f()
+In []: f()
---------------------------------------
\end{lstlisting}
\alert{\typ{TypeError:}}\typ{f() takes exactly 1 argument}
@@ -301,7 +301,7 @@
\begin{frame}[fragile]
\frametitle{\typ{fsolve} \ldots}
-Find the root of $sin(x)+cos^2(x)$ nearest to $0$
+Find the root of $sin(z)+cos^2(z)$ nearest to $0$
\begin{lstlisting}
In []: fsolve(f, 0)
Out[]: -0.66623943249251527
@@ -313,16 +313,16 @@
\begin{frame}[fragile]
\frametitle{Exercise Problem}
- Find the root of the equation $x^2 - sin(x) + cos^2(x)$ nearest to $0$
+ Find the root of the equation $x^2 - sin(x) + cos^2(x) == tan(x)$ nearest to $0$
\end{frame}
\begin{frame}[fragile]
\frametitle{Solution}
\begin{small}
\begin{lstlisting}
- def f(x):
- return x**2 - sin(x) + cos(x)*cos(x)
- fsolve(f, 0)
+def f(x):
+ return x**2 - sin(x) + cos(x)*cos(x) - tan(x)
+fsolve(f, 0)
\end{lstlisting}
\end{small}
\begin{center}