diff options
author | Puneeth Chaganti | 2010-01-10 16:43:15 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2010-01-10 16:43:15 +0530 |
commit | 268a25c7e1721e7a0c51080dd128b68d0ad3a4d5 (patch) | |
tree | 15fd6b6def962518fdda7ebaaa455eda63533a09 | |
parent | feabb1aa4fdb4dd974c81175eefc9b1e50ee951f (diff) | |
download | workshops-more-scipy-268a25c7e1721e7a0c51080dd128b68d0ad3a4d5.tar.gz workshops-more-scipy-268a25c7e1721e7a0c51080dd128b68d0ad3a4d5.tar.bz2 workshops-more-scipy-268a25c7e1721e7a0c51080dd128b68d0ad3a4d5.zip |
Moved all day1 quiz questions to end of day1-sessions.
-rwxr-xr-x | day1/cheatsheet4.tex | 2 | ||||
-rw-r--r-- | day1/session1.tex | 30 | ||||
-rw-r--r-- | day1/session2.tex | 44 | ||||
-rw-r--r-- | day1/session3.tex | 82 | ||||
-rw-r--r-- | day1/session4.tex | 95 | ||||
-rwxr-xr-x | day1/session6.tex | 127 | ||||
-rw-r--r-- | day1quiz1.tex | 214 | ||||
-rw-r--r-- | day1quiz2.tex | 231 |
8 files changed, 379 insertions, 446 deletions
diff --git a/day1/cheatsheet4.tex b/day1/cheatsheet4.tex index 7410368..70395fc 100755 --- a/day1/cheatsheet4.tex +++ b/day1/cheatsheet4.tex @@ -136,7 +136,7 @@ In above mentioned case, \typ{'::2'} means, start from first row, till last row( \begin{lstlisting} In []: C[:,::2] Out[]: -xarray([[ 1, 2], +array([[ 1, 2], [ 0, 0], [-1, 7]]) \end{lstlisting} diff --git a/day1/session1.tex b/day1/session1.tex index 779745d..92b577f 100644 --- a/day1/session1.tex +++ b/day1/session1.tex @@ -521,3 +521,33 @@ Save commands of review problem into file \end{document} +%% Questions for Quiz %% +%% ------------------ %% + +\begin{frame}[fragile] +\frametitle{\incqno } +Describe the plot produced by the following: +\begin{lstlisting} +In []: x = linspace(0, 2*pi) +In []: plot(x, cos(x), 'go') +\end{lstlisting} +\end{frame} + +\begin{frame} +\frametitle{\incqno } +How will you plot the previous graph with line width set to 3? How will +you set the $x$ and $y$ labels of the plot? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +How will you set the x and y axis limits so that the region of interest +is in the rectangle $(0, -1.5)$ (left bottom coordinate) and $(2\pi, +1.5)$ (right top coordinate)? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +What ipython magic command do you use to obtain the lines of code you have already typed in the interpreter? What command do you use to save them? +\end{frame} + diff --git a/day1/session2.tex b/day1/session2.tex index 12dbb58..a845d98 100644 --- a/day1/session2.tex +++ b/day1/session2.tex @@ -479,3 +479,47 @@ plot(l, tsq, '.') \end{frame} \end{document} + +%% Questions for Quiz %% +%% ------------------ %% + +\begin{frame}[fragile] +\frametitle{\incqno } + \begin{lstlisting} + In []: a = [1, 2, 5, 9] + In []: a[0:-1] + \end{lstlisting} + What is the output? +\end{frame} + +\begin{frame} +\frametitle{\incqno } + How do you combine two lists \emph{a} and \emph{b} to produce one list? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } + \begin{lstlisting} + In []: a = [1, 2, 5, 9] + \end{lstlisting} + How do you add the value 10 to the end of this list? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +Write the code to read a file \texttt{data.txt} and print each line of it? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +The following code snippet has an error/bug: +\begin{lstlisting} +In []: l = [0.1, 0.2, 0.3, 0.4] +In []: t = [0.69, 0.90, 1.19, 1.30] +In []: tsq = [] +In []: for time in t: + ....: tsq.append(time*time) + ....: plot(l, tsq) +\end{lstlisting} +What is the error? How do you fix it? +\end{frame} diff --git a/day1/session3.tex b/day1/session3.tex index c769fe5..2de2634 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -453,3 +453,85 @@ print 'Standard Deviation: ', \end{frame} \end{document} + +%% Questions for Quiz %% +%% ------------------ %% + +\begin{frame} +\frametitle{\incqno } + A sample line from a Comma Separated Values (CSV) file:\\ + \vspace*{0.2in} + \emph{Rossum, Guido, 42, 56, 34, 54}\\ + \vspace*{0.2in} + What code would you use to separate the line into fields? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } + \begin{lstlisting} + In []: a = [1, 2, 5, 9] + \end{lstlisting} + How do you find the length of this list? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } + \begin{lstlisting} + In [1]: d = { + 'a': 1, + 'b': 2 + } + In [2]: print d['c'] + \end{lstlisting} + What is the output? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: sc = {'A': 10, 'B': 20, + 'C': 70} +\end{lstlisting} +Given the above dictionary, what command will you give to plot a +pie-chart? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: marks = [10, 20, 30, 50, 55, + 75, 83] +\end{lstlisting} +Given the above marks, how will you calculate the \alert{mean} and +\alert{standard deviation}? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: marks = [10, 20, 30, 50, 55, + 75, 83] +\end{lstlisting} +How will you convert the list \texttt{marks} to an \alert{array}? +\end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% \begin{lstlisting} +%% for x in "abcd": +%% print x + +%% a +%% b +%% c +%% d +%% \end{lstlisting} +%% How do you get the following output? +%% \begin{lstlisting} +%% 0 a +%% 1 b +%% 2 c +%% 3 d +%% \end{lstlisting} +%% \end{frame} + diff --git a/day1/session4.tex b/day1/session4.tex index bfff165..ddac34a 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -607,3 +607,98 @@ In []: plot(l, Tline) \end{frame} \end{document} + +%% Questions for Quiz %% +%% ------------------ %% + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: a = array([[1, 2], + [3, 4]]) +In []: a[1,0] = 0 +\end{lstlisting} +What is the resulting array? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} + In []: x = array(([1,2,3,4], + [2,3,4,5])) + In []: x[-2][-3] = 4 + In []: print x +\end{lstlisting} +What will be printed? +\end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% \begin{lstlisting} +%% In []: x = array([[1,2,3,4], +%% [3,4,2,5]]) +%% \end{lstlisting} +%% What is the \lstinline+shape+ of this array? +%% \end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} + In []: x = array([[1,2,3,4]]) +\end{lstlisting} +How to \lstinline+x+ to \lstinline+array([[1,2,0,4]])+? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} + In []: x = array([[1,2,3,4], + [3,4,2,5]]) +\end{lstlisting} +How do you get the following slice of \lstinline+x+? +\begin{lstlisting} +array([[2,3], + [4,2]]) +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: a = array([[1, 2], + [3, 4]]) +\end{lstlisting} +How do you get the transpose of this array? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: a = array([[1, 2], + [3, 4]]) +In []: b = array([[1, 1], + [2, 2]]) +In []: a*b +\end{lstlisting} +What does this produce? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +What command do you use to find the inverse of a matrix and its +eigenvalues? +\end{frame} + +%% \begin{frame} +%% \frametitle{\incqno } +%% The file \lstinline+datafile.txt+ contains 3 columns of data. What +%% command will you use to read the entire data file into an array? +%% \end{frame} + +%% \begin{frame} +%% \frametitle{\incqno } +%% If the contents of the file \lstinline+datafile.txt+ is read into an +%% $N\times3$ array called \lstinline+data+, how would you obtain the third +%% column of this data? +%% \end{frame} + diff --git a/day1/session6.tex b/day1/session6.tex index 0f2120f..409f07c 100755 --- a/day1/session6.tex +++ b/day1/session6.tex @@ -428,3 +428,130 @@ In []: pend_sol = odeint(pend_int, \end{frame} \end{document} + +%% Questions for Quiz %% +%% ------------------ %% + +\begin{frame} +\frametitle{\incqno } +Given a 4x4 matrix \texttt{A} and a 4-vector \texttt{b}, what command do +you use to solve for the equation \\ +\texttt{Ax = b}? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +What command will you use if you wish to integrate a system of ODEs? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +How do you calculate the roots of the polynomial, $y = 1 + 6x + 8x^2 + +x^3$? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +Two arrays \lstinline+a+ and \lstinline+b+ are numerically almost equal, what command +do you use to check if this is true? +\end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% \begin{lstlisting} +%% In []: x = arange(0, 1, 0.25) +%% In []: print x +%% \end{lstlisting} +%% What will be printed? +%% \end{frame} + + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% \begin{lstlisting} +%% from scipy.integrate import quad +%% def f(x): +%% res = x*cos(x) +%% quad(f, 0, 1) +%% \end{lstlisting} +%% What changes will you make to the above code to make it work? +%% \end{frame} + +%% \begin{frame} +%% \frametitle{\incqno } +%% What two commands will you use to create and evaluate a spline given +%% some data? +%% \end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% What would be the result? +%% \begin{lstlisting} +%% In []: x +%% array([[0, 1, 2], +%% [3, 4, 5], +%% [6, 7, 8]]) +%% In []: x[::-1,:] +%% \end{lstlisting} +%% Hint: +%% \begin{lstlisting} +%% In []: x = arange(9) +%% In []: x[::-1] +%% array([8, 7, 6, 5, 4, 3, 2, 1, 0]) +%% \end{lstlisting} +%% \end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% What would be the result? +%% \begin{lstlisting} +%% In []: y = arange(3) +%% In []: x = linspace(0,3,3) +%% In []: x-y +%% \end{lstlisting} +%% \end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% \begin{lstlisting} +%% In []: x +%% array([[ 0, 1, 2, 3], +%% [ 4, 5, 6, 7], +%% [ 8, 9, 10, 11], +%% [12, 13, 14, 15]]) +%% \end{lstlisting} +%% How will you get the following \lstinline+x+? +%% \begin{lstlisting} +%% array([[ 5, 7], +%% [ 9, 11]]) +%% \end{lstlisting} +%% \end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% What would be the output? +%% \begin{lstlisting} +%% In []: y = arange(4) +%% In []: x = array(([1,2,3,2],[1,3,6,0])) +%% In []: x + y +%% \end{lstlisting} +%% \end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% \begin{lstlisting} +%% In []: line = plot(x, sin(x)) +%% \end{lstlisting} +%% Use the \lstinline+set_linewidth+ method to set width of \lstinline+line+ to 2. +%% \end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% What would be the output? +%% \begin{lstlisting} +%% In []: x = arange(9) +%% In []: y = arange(9.) +%% In []: x == y +%% \end{lstlisting} +%% \end{frame} + diff --git a/day1quiz1.tex b/day1quiz1.tex index 5aa44c3..d0da0dd 100644 --- a/day1quiz1.tex +++ b/day1quiz1.tex @@ -42,8 +42,6 @@ \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} \date[] {\today \\Day 1, Quiz 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - \begin{document} \begin{frame} @@ -60,216 +58,4 @@ On the top right hand corner please write down the following: \end{itemize} \end{frame} -\begin{frame}[fragile] -\frametitle{\incqno } -Describe the plot produced by the following: - -\begin{lstlisting} -In []: x = linspace(0, 2*pi) -In []: plot(x, cos(x), 'go') -\end{lstlisting} -\end{frame} - -\begin{frame} -\frametitle{\incqno } -How will you plot the previous graph with line width set to 3? How will -you set the $x$ and $y$ labels of the plot? -\end{frame} - -\begin{frame} -\frametitle{\incqno } -How will you set the x and y axis limits so that the region of interest -is in the rectangle $(0, -1.5)$ (left bottom coordinate) and $(2\pi, -1.5)$ (right top coordinate)? -\end{frame} - -\begin{frame} -\frametitle{\incqno } - A sample line from a Comma Separated Values (CSV) file:\\ - \vspace*{0.2in} - \emph{Rossum, Guido, 42, 56, 34, 54}\\ - \vspace*{0.2in} - What code would you use to separate the line into fields? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } - \begin{lstlisting} - In []: a = [1, 2, 5, 9] - In []: a[0:-1] - \end{lstlisting} - What is the output? -\end{frame} - -\begin{frame} -\frametitle{\incqno } - How do you combine two lists \emph{a} and \emph{b} to produce one list? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } - \begin{lstlisting} - In []: a = [1, 2, 5, 9] - \end{lstlisting} - How do you add the value 10 to the end of this list? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } - \begin{lstlisting} - In []: a = [1, 2, 5, 9] - \end{lstlisting} - How do you find the length of this list? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } - \begin{lstlisting} - In [1]: d = { - 'a': 1, - 'b': 2 - } - In [2]: print d['c'] - \end{lstlisting} - What is the output? -\end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% for x in "abcd": -%% print x - -%% a -%% b -%% c -%% d -%% \end{lstlisting} -%% How do you get the following output? -%% \begin{lstlisting} -%% 0 a -%% 1 b -%% 2 c -%% 3 d -%% \end{lstlisting} -%% \end{frame} - -\begin{frame} -\frametitle{\incqno } -What ipython magic command do you use to obtain the lines of code you have already typed in the interpreter? What command do you use to save them? -\end{frame} - -\begin{frame} -\begin{lstlisting} -In []: sc = {'A': 10, 'B': 20, - 'C': 70} -\end{lstlisting} -Given the above dictionary, what command will you give to plot a -pie-chart? -\end{frame} - - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} -In []: marks = [10, 20, 30, 50, 55, - 75, 83] -\end{lstlisting} - -Given the above marks, how will you calculate the \alert{mean} and -\alert{standard deviation}? -\end{frame} - -%\begin{frame}[fragile] -%\frametitle{\incqno } -%\begin{lstlisting} -%In []: marks = [10, 20, 30, 50, 55, -% 75, 83] -%\end{lstlisting} -%How will you convert the list \texttt{marks} to an \alert{array}? -%\end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% In []: a = array([[1, 2], -%% [3, 4]]) -%% In []: a[1,0] = 0 -%% \end{lstlisting} -%% What is the resulting matrix? -%% \end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% In []: a = array([[1, 2], -%% [3, 4]]) -%% \end{lstlisting} -%% How do you get the transpose of this array? -%% \end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% In []: a = array([[1, 2], -%% [3, 4]]) -%% In []: b = array([[1, 1], -%% [2, 2]]) -%% In []: a*b -%% \end{lstlisting} -%% What does this produce? -%% \end{frame} - -%% \begin{frame} -%% \frametitle{\incqno } -%% What command do you use to find the inverse of a matrix and its -%% eigenvalues? -%% \end{frame} - -%% \begin{frame} -%% \frametitle{\incqno } -%% Given a 4x4 matrix \texttt{A} and a 4-vector \texttt{b}, what command do -%% you use to solve for the equation \\ -%% \texttt{Ax = b}? -%% \end{frame} - -\begin{frame} -\frametitle{\incqno } -Write the code to read a file \texttt{data.txt} and print each line of it? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -What is the output of: -\begin{lstlisting} -In []: x=linspace(0 , 2 * pi) -In []: plot(x, cos(x),'go') -\end{lstlisting} -\end{frame} - -\begin{frame} -\frametitle{\incqno } -Draw a plot with line width 3. -\end{frame} - -\begin{frame} -\frametitle{\incqno } -Setting x and y axis limits. -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -The following code snippet has an error/bug: -\begin{lstlisting} -In []: l = [0.1, 0.2, 0.3, 0.4] -In []: t = [0.69, 0.90, 1.19, 1.30] -In []: tsq = [] -In []: for time in t: - ....: tsq.append(time*time) - ....: plot(l, tsq) -\end{lstlisting} - -What is the error? How do you fix it? -\end{frame} - \end{document} diff --git a/day1quiz2.tex b/day1quiz2.tex index b7bfe2f..05ab609 100644 --- a/day1quiz2.tex +++ b/day1quiz2.tex @@ -61,237 +61,6 @@ On the top right hand corner please write down the following: \end{itemize} \end{frame} -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% In []: x = array([[1,2,3,4], -%% [3,4,2,5]]) -%% \end{lstlisting} -%% What is the \lstinline+shape+ of this array? -%% \end{frame} - - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} - In []: x = array([[1,2,3,4]]) -\end{lstlisting} -How to change the third element (i.e.\ 3) of \lstinline+x+ to 0? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} - In []: x = array([[1,2,3,4], - [3,4,2,5]]) -\end{lstlisting} -How do you get the following slice of \lstinline+x+? -\begin{lstlisting} -array([[2,3], - [4,2]]) -\end{lstlisting} -\end{frame} - - -%% \begin{frame} -%% \frametitle{\incqno } -%% The file \lstinline+datafile.txt+ contains 3 columns of data. What -%% command will you use to read the entire data file into an array? -%% \end{frame} - -%% \begin{frame} -%% \frametitle{\incqno } - -%% If the contents of the file \lstinline+datafile.txt+ is read into an -%% $N\times3$ array called \lstinline+data+, how would you obtain the third -%% column of this data? - -%% \end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} - In []: x = array(([1,2,3,4], - [2,3,4,5])) - In []: x[-2][-3] = 4 - In []: print x -\end{lstlisting} -What will be printed? -\end{frame} - - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% In []: x = arange(0, 1, 0.25) -%% In []: print x -%% \end{lstlisting} -%% What will be printed? -%% \end{frame} - - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% from scipy.integrate import quad -%% def f(x): -%% res = x*cos(x) - -%% quad(f, 0, 1) -%% \end{lstlisting} - -%% What changes will you make to the above code to make it work? -%% \end{frame} - -%% \begin{frame} -%% \frametitle{\incqno } -%% What two commands will you use to create and evaluate a spline given -%% some data? -%% \end{frame} - -\begin{frame} -\frametitle{\incqno } -What command will you use if you wish to integrate a system of ODEs? -\end{frame} - -\begin{frame} -\frametitle{\incqno } -How do you calculate the roots of the polynomial, $y = 1 + 6x + 8x^2 + -x^3$? -\end{frame} - -\begin{frame} -\frametitle{\incqno } - -Two arrays \lstinline+a+ and \lstinline+b+ are numerically almost equal, what command -do you use to check if this is true? - -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} -In []: marks = [10, 20, 30, 50, 55, - 75, 83] -\end{lstlisting} -How will you convert the list \texttt{marks} to an \alert{array}? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} -In []: a = array([[1, 2], - [3, 4]]) -In []: a[1,0] = 0 -\end{lstlisting} -What is the resulting matrix? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} -In []: a = array([[1, 2], - [3, 4]]) -\end{lstlisting} -How do you get the transpose of this array? -\end{frame} - -\begin{frame}[fragile] -\frametitle{\incqno } -\begin{lstlisting} -In []: a = array([[1, 2], - [3, 4]]) -In []: b = array([[1, 1], - [2, 2]]) -In []: a*b -\end{lstlisting} -What does this produce? -\end{frame} - -\begin{frame} -\frametitle{\incqno } -What command do you use to find the inverse of a matrix and its -eigenvalues? -\end{frame} - -\begin{frame} -\frametitle{\incqno } -Given a 4x4 matrix \texttt{A} and a 4-vector \texttt{b}, what command do -you use to solve for the equation \\ -\texttt{Ax = b}? -\end{frame} - \end{document} -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% What would be the result? -%% \begin{lstlisting} -%% In []: x -%% array([[0, 1, 2], -%% [3, 4, 5], -%% [6, 7, 8]]) -%% In []: x[::-1,:] -%% \end{lstlisting} -%% Hint: -%% \begin{lstlisting} -%% In []: x = arange(9) -%% In []: x[::-1] -%% array([8, 7, 6, 5, 4, 3, 2, 1, 0]) -%% \end{lstlisting} -%% \end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% What would be the result? -%% \begin{lstlisting} -%% In []: y = arange(3) -%% In []: x = linspace(0,3,3) -%% In []: x-y -%% \end{lstlisting} -%% \end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% In []: x -%% array([[ 0, 1, 2, 3], -%% [ 4, 5, 6, 7], -%% [ 8, 9, 10, 11], -%% [12, 13, 14, 15]]) -%% \end{lstlisting} -%% How will you get the following \lstinline+x+? -%% \begin{lstlisting} -%% array([[ 5, 7], -%% [ 9, 11]]) -%% \end{lstlisting} -%% \end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% What would be the output? -%% \begin{lstlisting} -%% In []: y = arange(4) -%% In []: x = array(([1,2,3,2],[1,3,6,0])) -%% In []: x + y -%% \end{lstlisting} -%% \end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% \begin{lstlisting} -%% In []: line = plot(x, sin(x)) -%% \end{lstlisting} -%% Use the \lstinline+set_linewidth+ method to set width of \lstinline+line+ to 2. -%% \end{frame} - -%% \begin{frame}[fragile] -%% \frametitle{\incqno } -%% What would be the output? -%% \begin{lstlisting} -%% In []: x = arange(9) -%% In []: y = arange(9.) -%% In []: x == y -%% \end{lstlisting} -%% \end{frame} |