\documentclass [12pt] {article}

\usepackage{graphicx, xypic,amsmath,amssymb,epstopdf,amsthm,amsfonts}
\usepackage[all]{xy}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\newenvironment{packed_itemize}{
\begin{itemize}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{itemize}}
\newenvironment{packed_enum}{
\begin{enumerate}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{enumerate}}


\topmargin 0pt
\advance \topmargin by -\headheight
\advance \topmargin by -\headsep
\textheight 8.9in
\oddsidemargin 0pt
\evensidemargin \oddsidemargin
\marginparwidth 0.5in
\textwidth 6.5in

\newtheorem{thm}{Definition}
\newtheorem{sage}{Sage}
\newtheorem{warn}{WARNING}

\begin{document}
\begin{center}

{\Huge{Sets \& Stuff}}\\
\end{center}


\small
\noindent In groups, open your own Sage Notebook and work on the following.  You are free to work with a copy of ``Sage Examples" (posted on the class webpage).

\normalsize
\begin{enumerate}
\item Enter the sets $A$, $Z$, and $B$ defined in class into sage.  Also create the set  $C=\{ x^2 \vert x\in \mathbb{Z} \wedge 0\leq x^2\leq 10000\}$ in sage.

\small
\begin{thm} The \emph{cardinality} of a finite set $X$ is equal to the number of elements in the set $X$ and is denoted as $\vert X \vert$.
\end{thm}

\begin{sage} If $X$ is a Set, then $\vert X \vert$ can be found with ``X.cardinality{}". If $Y$ is a list, then the length can be returned with ``len(Y)".
\end{sage}

\normalsize
\item Find each of the following:

\begin{enumerate}
\item the number of elements in the set $A$.
\vspace{.3in}
\item $\vert Z \vert$
\vspace{.3in}
\item the cardinality of the set $C$.
\vspace{.3in}
\end{enumerate}

\small
\begin{thm} Let $X$ and $Y$ be sets.  The \emph{Cartesian product} of $X$ and $Y$, denoted by $X\times Y$, is the set of all ordered pairs $[x,y]$ where $x\in X$ and $y\in Y$.  
\end{thm}

\begin{sage} If $X$ and $Y$ are sets then $X\times Y$ can be found with ``CartesianProduct(X,Y)".
\end{sage}

\normalsize
\item Write out 10 elements from $C\times B$ and 2 elements from $B\times C$.
\vspace{.3in}
\item Find $\vert C \times B \vert$.
\vspace{.3in}

\small
\begin{thm} Given a set $X$, the \emph{power set} of $X$ is the set of all subsets of the set $X$ and is denoted by $\mathcal P(X)$
\end{thm}

\begin{sage}If $X$ is a set then Sage needs to uses a hash to create $\mathcal P(X)$.  The command ``list(powerset(X))" returns a \emph{list} instead of a \emph{Set}.
\end{sage}

\normalsize
\item Write down $\mathcal P (\{2,3,-4,5,6.3,1/2,42\})$.
\vspace{.3in}
\item Find $\vert \mathcal P (\{2,3,-4,5,6.3,1/2,42\}) \vert $ and $\vert \mathcal P (B)\vert$.  Be Careful!! 
\vspace{.3in}





\newpage


\item Consider the sets $S$ and $T$ within the Universal set $U$.  For each of the following, identify the regions on the Venn diagram and determine if any of them are describing the same set.

(a) $S$  \hspace{3in} (b) $\overline{(\overline{S})}$

\vspace{-.3in}\hspace{-.5in}\includegraphics[height=2.5in]{VennDiagram} \includegraphics[height=2.5in]{VennDiagram}


(c) $\overline{S\cap T}$ \hspace{2.7in} (d) $\overline{S\cup T}$

\vspace{-.3in}\hspace{-.5in}\includegraphics[height=2.5in]{VennDiagram} \includegraphics[height=2.5in]{VennDiagram}

(e) $\overline{S} \cap \overline{T}$ \hspace{2.7in} (f) $\overline{S}\cup \overline{T}$

\vspace{-.3in}\hspace{-.5in}\includegraphics[height=2.5in]{VennDiagram} \includegraphics[height=2.5in]{VennDiagram}


\end{enumerate}
\end{document}
