\section{Exercises}
\begin{footnotesize} 
\subsection*{Targeted exercises} 

\subsubsection*{Exercises for Section \ref{Integrating_data_using_scipy.integrate}} 
\begin{enumerate}\setcounter{enumi}{-1}
	\item  The cumulative integral is the integral from the beginning of the data up to a given data point, plotted against the value of the last data point integrated.  Write a code that plots the cumulative integral of a Gaussian function with an amplitude of 1, a center of 5, and a width of 1, from 0 to 10 with 100 points on the $x$-axis. 

	
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Generating_test_data_to_evaluate_the_accuracy_of_numerical_analysis}} 
\begin{enumerate}\setcounter{enumi}{0}
	\item  Write two functions, one that returns a Lorentzian distribution and one that returns a log-normal distribution.  You can either write them yourself or import these functions from LMFIT now that you know how to find them in the library files (see Exercise 4 of Chapter 7).  These functions should take as arguments the $x$ data points, the center, the sigma (width), and the amplitude. Generate four different $x$-data arrays spanning 0 to 10 with 10, 50, 100, 1000 points, respectively.  For each, of these $x$-data arrays:
    \begin{itemize}
        \item Generate the corresponding $y$-values for a mean of 5, a width of 0.5, and an amplitude of 1.  Because you have two functions, you will have 8 $y$-value arrays. 
	\item Numerically integrate these 8 $y$-value arrays.
	\item Make a log-log plot of the difference between the numerical solution and the known analytical solution (1, since they are normalized) as a function of the spacing between the points on $x$-value arrays.  
	\item Increase the width to 1, 2, and 4 and integrate each the same way over the same range.  You will notice that the accuracy decreases substantially.  Why?
    \end{itemize}
    
\end{enumerate}
\subsubsection*{Exercises for Section \ref{Creating_customized_versions_of_existing_functions_using_wrappers}} 
\begin{enumerate}\setcounter{enumi}{1}

	\item  Write a wrapper that combines \lstinline{quickReadCSV()} and \lstinline{quickOpenFilename()} from \lstinline{codechembook.quickTools} so that you can quickly read a csv file using a dialog box to identify the file.  

\end{enumerate}
\subsubsection*{Exercises for Section \ref{Simplifying_the_processing_of_iterable_objects_using_comprehensions}} 
\begin{enumerate}\setcounter{enumi}{2}
	\item  Write a list comprehension that accomplishes each of the following tasks, in a single line of code:
    \begin{enumerate}
        \item Add the suffix \lstinline{_old} to each name in a list of names (as strings). You could also use this approach to rename, for example, files in a list of files. 
	\item Cerate a sine wave with amplitude 1 and 10 points spanning 0 to $2\pi$.  Create a list of points that are positive or zero and a second list of the points that are negative.
	\item Redo what you just did, but now change the value of the numbers failing the test to zero instead of omitting them from the list.
	\item Create a new list that contains the three point moving average (the current point, the point prior, and the point after) of your list for positive values from part c. Your new list will have to have two fewer items in it than the original list.  You might use this to attempt to smooth data---though we will address much ways to smooth data in the next chapter. 
	\item Calculate the slope between adjacent points for the same list.  Your new list will have to have one less points in it than the original list.  This might be used to take the numerical derivative of your data. This idea will be explored much more thoroughly in Chapter 13.
    \end{enumerate}

    For each of these, invent some test data and use it to verify that your solution works.
\end{enumerate}

\subsection*{Comprehensive exercises} 
\begin{enumerate}\setcounter{enumi}{3}

\item  Write a code where you can supply a lists of arbitrary numbers of initial and final integration limits and then the code will integrate data over these limits and output the results for each range. 



\end{enumerate}
\end{footnotesize} 
