diff options
Diffstat (limited to 'day1/session6.tex')
-rwxr-xr-x | day1/session6.tex | 127 |
1 files changed, 127 insertions, 0 deletions
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} + |