diff --git a/Assignments/A2/A2.pdf b/Assignments/A2/A2.pdf index 8e9482162d11fdee67985d132ed01effa040d580..c3d606a08e173b8ca8596d5993e5f1f551da77bb 100644 Binary files a/Assignments/A2/A2.pdf and b/Assignments/A2/A2.pdf differ diff --git a/Assignments/A2/A2.tex b/Assignments/A2/A2.tex index ef92fa23483d66bb5bcb136102017a0da536f90c..2c9886215dd22b72f4823ef209349158cabc0c32 100644 --- a/Assignments/A2/A2.tex +++ b/Assignments/A2/A2.tex @@ -91,17 +91,20 @@ break under a specified blast load. Write a module that creates a Curve ADT. It should consist of a Python code file named {\tt CurveADT.py}. The specification for this module is given at the -end of the assignment. Hint: The implementation will be easier if you use the -scipy function +end of the assignment. The exceptions for {\tt CurveADT.py} (and all other +modules) should be in the file {\tt Exceptions.py}. Hint: The implementation +will be easier if you use the scipy function \href{https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp1d.html}{\texttt{interp1d}}. + \section *{Step \refstepcounter{stepnum} \thestepnum} Write a module that implements an abstract object called Data. It should consist of a Python file named {\tt Data.py}. The new module should follow the specification given at the end of the assignment. Although efficient use of computing resources is always a good goal, your implementation will be judged on -correctness and not on performance. +correctness and not on performance. Remember, the exceptions should be defined +in the file {\tt Exceptions.py}. \section *{Step \refstepcounter{stepnum} \thestepnum} @@ -114,6 +117,7 @@ specification for this module is given at the end of the assignment. Write a library module for plotting curves. It should consist of a Python code file named {\tt Plot.py}. The specification for this module is given at the end of the assignment. You should use matplotlib for your implementation. +Remember, the exceptions should be defined in the file {\tt Exceptions.py}. \section *{Step \refstepcounter{stepnum} \thestepnum} @@ -150,15 +154,16 @@ repo. You should change these files. \section *{Step \refstepcounter{stepnum} \thestepnum} Submit (add, commit and push) the files {\tt CurveADT.py}, {\tt Data.py}, {\tt - SeqServices.py}, {\tt Plot.py}, {\tt Load.py} and {\tt testAll.py} using git. -Please \textbf{do not change} the names and locations for the files already -given in your git project repo. You should also push any input data files you -created for testing purposes. For Part 1, the only files that you should modify -are the Python files and the only ``new'' files you should create are the input -data files. Changing other files could result in a serious grading penalty, -since the TAs might not be able to run your code and documentation generation. -You should NOT submit your generated documentation (html and latex folders). In -general, files that can be regenerated are not put under version control. + SeqServices.py}, {\tt Plot.py}, {\tt Load.py}, {\tt Exceptions.py} and {\tt + testAll.py} using git. Please \textbf{do not change} the names and locations +for the files already given in your git project repo. You should also push any +input data files you created for testing purposes. For Part 1, the only files +that you should modify are the Python files and the only ``new'' files you +should create are the input data files. Changing other files could result in a +serious grading penalty, since the TAs might not be able to run your code and +documentation generation. You should NOT submit your generated documentation +(html and latex folders). In general, files that can be regenerated are not put +under version control. You should tag your final submission of Part 1 of the assignment with the label \texttt{A2Part1}. @@ -415,7 +420,9 @@ Data\_init & ~ & ~ & ~\\ \hline Data\_add & s: CurveT, $z: \mathbb{R}$ & ~ & Full, IndepVarNotAscending\\ \hline -Data\_eval & $x: \mathbb{R}, z: \mathbb{R}$ & ~ & ~\\ +Data\_getC & $i: \mathbb{N}$ & ~ & InvalidIndex\\ +\hline +Data\_eval & $x: \mathbb{R}, z: \mathbb{R}$ & ~ & OutOfDomain\\ \hline Data\_slice & $x: \mathbb{R}, i: \mathbb{N}$ & CurveT & ~\\ \hline @@ -453,6 +460,12 @@ Data\_init(): \leq Z_{|Z|-1} \Rightarrow \mbox{IndepVarNotAscending})$ \end{itemize} +\noindent Data\_getC($i$): +\begin{itemize} +\item output: $out := S[i]$ +\item exception: $exc := (\neg(0 \leq i < |S|) \Rightarrow \mbox{InvalidIndex})$ +\end{itemize} + \noindent Data\_eval($x, z$): \begin{itemize} \item output: $out := \mbox{interpLin}(Z_j, S_j.\mbox{eval}(x), Z_{j+1},