Skip to content
Snippets Groups Projects
Commit 2dd5b391 authored by W. Spencer Smith's avatar W. Spencer Smith
Browse files

Updates to A2, now includes selection of polynomial order

parent 5a29d461
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -279,15 +279,15 @@ Questions - rewrite isInBounds not assuming ascending
\newpage
\section* {Curve Interpolation ADT Module}
\section* {Curve ADT Module}
\subsection*{Template Module}
CurveInterpADT
CurveADT
\subsection* {Uses}
SeqServicesModule for isAscending, interp1d and index
SeqServicesModule
\subsection* {Syntax}
......@@ -297,7 +297,7 @@ MAX\_ORDER = 2
\subsubsection* {Exported Types}
CurveInterpT = ?
CurveT = ?
\subsubsection* {Exported Access Programs}
......@@ -305,8 +305,8 @@ CurveInterpT = ?
\hline
\textbf{Routine name} & \textbf{In} & \textbf{Out} & \textbf{Exceptions}\\
\hline
new CurveInterpT & $X: \mathbb{R}^n$, $Y: \mathbb{R}^n$, $i: \mathbb{N}$ &
CurveInterpT & IndepVarNotAscending,\newline InvalidInterpOrder\\
new CurveT & $X: \mathbb{R}^n$, $Y: \mathbb{R}^n$, $i: \mathbb{N}$ &
CurveT & IndepVarNotAscending,\newline InvalidInterpOrder\\
\hline
minD & ~ & $\mathbb{R}$ & ~\\
\hline
......@@ -333,14 +333,15 @@ None
\subsubsection* {Assumptions}
None
The user will not request function evaluations that would cause the
interpolation to select index values outside of where the function is defined.
\subsubsection* {Access Routine Semantics}
\noindent new CurveInterpT($X, Y$):
\noindent new CurveT($X, Y$):
\begin{itemize}
\item transition: $\mbox{minx}, \mbox{maxx}, o, f := X_0, X_{|X|-1}, i, (\lambda v:
\mbox{interp}(X, Y, v))$
\mbox{interp}(X, Y, o, v))$
\item output: $out := \mbox{self}$
\item exception: $(\neg \mbox{isAscending}(X) \Rightarrow
......@@ -373,11 +374,11 @@ None
\subsection*{Local Functions}
interp: $\mathbb{R}^n \times \mathbb{R}^n \times \mathbb{R} \times \mathbb{N}
interp: $\mathbb{R}^n \times \mathbb{R}^n \times \mathbb{N} \times \mathbb{R}
\rightarrow \mathbb{R}$\\
\noindent interp($X$, $Y$, $v$, $o$) $$\equiv (o=1 \Rightarrow \mbox{interpLin}(X_i, Y_i,
X_{i+1}, Y_{i+1}, v) | o = 2 \Rightarrow \mbox{interpQuad}(X_i, Y_i, X_{i+1},
\noindent interp($X$, $Y$, $o$, $v$) $$\equiv (o=1 \Rightarrow \mbox{interpLin}(X_i, Y_i,
X_{i+1}, Y_{i+1}, v) | o = 2 \Rightarrow \mbox{interpQuad}(X_{i-1}, Y_{i-1}, X_i, Y_i, X_{i+1},
Y_{i+1}, v) )$$ where $i = \mbox{index}(X, v)$\\
\newpage
......@@ -390,7 +391,7 @@ DataModule
\subsection* {Uses}
CurveInterpT, SeqServicesModule for interp1d and index
CurveT, SeqServicesModule for interpLin and index
\subsection* {Syntax}
......@@ -406,11 +407,11 @@ MAX\_SIZE = 10
\hline
Data\_init & ~ & ~ & ~\\
\hline
Data\_add & c: CurveInterpT, $z: \mathbb{R}$ & ~ & Full, IndepVarNotAscending\\
Data\_add & c: CurveT, $z: \mathbb{R}$ & ~ & Full, IndepVarNotAscending\\
\hline
eval & $x: \mathbb{R}, z: \mathbb{R}$ & ~ & ~\\
\hline
slice & $x: \mathbb{R}$ & CurveInterpT & ~\\
slice & $x: \mathbb{R}$ & CurveT & ~\\
\hline
\end{tabular}
......@@ -419,7 +420,7 @@ slice & $x: \mathbb{R}$ & CurveInterpT & ~\\
\subsubsection* {State Variables}
$s$: sequence of CurveInterpT\\
$s$: sequence of CurveT\\
$Z$: sequence of $\mathbb{R}$
\subsubsection* {State Invariant}
......@@ -448,14 +449,14 @@ Data\_init():
\noindent Data\_eval($x, z$):
\begin{itemize}
\item output: $out := \mbox{interp1d}(z_j, s_j.\mbox{eval}(x), z_{j+1},
\item output: $out := \mbox{interpLin}(z_j, s_j.\mbox{eval}(x), z_{j+1},
s_{j+1}.\mbox{eval}(x), z)$, where $j = \mbox{index}(Z, z)$
\item exception: $exc := (\neg \mbox{isInBounds}(Z, z) \Rightarrow \mbox{OutOfDomain})$
\end{itemize}
\noindent Data\_slice($x$):
\begin{itemize}
\item output: $out := \mbox{CurveInterpT}(Z, Y)$, where
\item output: $out := \mbox{CurveT}(Z, Y)$, where
$Y = ||(i: \mathbb{N}| i \in [0 .. |Z|-1] : \langle s_i.\mbox{eval}(x) \rangle
)$ or $Y = \mbox{ map } \mbox{eval}(x) \mbox{ } s$ \textit{\# in both cases
there is an abuse of notation}
......@@ -490,7 +491,7 @@ isAscending & $x: \mathbb{R}^n$ & $\mathbb{B}$ & ~\\
\hline
isInBounds & $x: \mathbb{R}^n, \mathbb{R}$ & $\mathbb{B}$ & ~\\
\hline
interp1d & $x_1: \mathbb{R}, y_1: \mathbb{R}, x_2: \mathbb{R}, y_2: \mathbb{R},
interpLin & $x_1: \mathbb{R}, y_1: \mathbb{R}, x_2: \mathbb{R}, y_2: \mathbb{R},
x: \mathbb{R}$ & $\mathbb{R}$ & ~\\
\hline
index & $X: \mathbb{R}^n, x: \mathbb{R}$ & $\mathbb{N}$ & ~\\
......@@ -533,9 +534,10 @@ None, unless noted with a particular access program
\item exception: none
\end{itemize}
\noindent interpQuad($x_1, y_1, x_2, y_2, x$) \textit{\# assuming isAscending is True}
\noindent interpQuad($x_0, y_0, x_1, y_1, x_2, y_2, x$) \textit{\# assuming isAscending is True}
\begin{itemize}
\item output: $out := \frac{(y_2 - y_1)}{(x_2-x_1)} (x - x_1) + y_1$
\item output: $out := y_1 + \frac{y_2 - y_0}{x_2-x_0} (x - x_1) + \frac{y_2 - 2 y_1 + y_0}{2
(x_2-x_1)^2} (x - x_1)^2$
\item exception: none
\end{itemize}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment