489 For example, \texttt{linspace(0, 5, 11)}, should return, \\ |
489 For example, \texttt{linspace(0, 5, 11)}, should return, \\ |
490 \begin{verbatim} |
490 \begin{verbatim} |
491 [ 0.0 , 0.5, 1.0 , 1.5, 2.0 , 2.5, |
491 [ 0.0 , 0.5, 1.0 , 1.5, 2.0 , 2.5, |
492 3.0 , 3.5, 4.0 , 4.5, 5.0 ] |
492 3.0 , 3.5, 4.0 , 4.5, 5.0 ] |
493 \end{verbatim} |
493 \end{verbatim} |
494 \item[3.4a] Use the \texttt{linspace} function and generate a list of N tuples of the form\\ |
494 \item[3.4] Use the \texttt{linspace} function and generate a list of N tuples of the form\\ |
495 \texttt{[($x_1$,f($x_1$)),($x_2$,f($x_2$)),\ldots,($x_N$,f($x_N$))]}\\for the following functions, |
495 \texttt{[($x_1$,f($x_1$)),($x_2$,f($x_2$)),\ldots,($x_N$,f($x_N$))]}\\for the following functions, |
496 \begin{itemize} |
496 \begin{itemize} |
497 \item \texttt{f(x) = sin(x)} |
497 \item \texttt{f(x) = sin(x)} |
498 \item \texttt{f(x) = sin(x) + sin(10*x)}. |
498 \item \texttt{f(x) = sin(x) + sin(10*x)}. |
499 \end{itemize} |
499 \end{itemize} |
500 |
500 |
501 \item[3.4b] Using the tuples generated earlier, determine the intervals where the roots of the functions lie. |
501 \item[3.5] Using the tuples generated earlier, determine the intervals where the roots of the functions lie. |
502 \end{description} |
502 \end{description} |
503 |
503 |
504 \section{IO} |
504 \section{IO} |
505 \subsection{Simple tokenizing and parsing} |
505 \subsection{Simple tokenizing and parsing} |
506 \begin{verbatim} |
506 \begin{verbatim} |
508 over the lazy dog""" |
508 over the lazy dog""" |
509 for word in s.split(): |
509 for word in s.split(): |
510 print word.capitalize() |
510 print word.capitalize() |
511 \end{verbatim} |
511 \end{verbatim} |
512 |
512 |
|
513 \section{Problem Set 4} |
513 \begin{description} |
514 \begin{description} |
514 \item[4.1] Given a string like, ``1, 3-7, 12, 15, 18-21'', produce the list\\ |
515 \item[4.1] Given a string like, ``1, 3-7, 12, 15, 18-21'', produce the list\\ |
515 \texttt{[1,3,4,5,6,7,12,15,18,19,20,21]} |
516 \texttt{[1,3,4,5,6,7,12,15,18,19,20,21]} |
516 \end{description} |
517 \end{description} |
517 |
518 |