mirror of
https://github.com/janishutz/eth-summaries.git
synced 2025-11-25 02:24:23 +00:00
[NumCS] Introduction to Stückweise Interpolation
This commit is contained in:
Binary file not shown.
@@ -119,5 +119,12 @@ Moral of the story: Use descriptive variable names and do NOT use $t$, $tt$, $tt
|
|||||||
\input{parts/01_interpolation/01_trigonometric/03_interpolation/01_zero-padding.tex}
|
\input{parts/01_interpolation/01_trigonometric/03_interpolation/01_zero-padding.tex}
|
||||||
\input{parts/01_interpolation/01_trigonometric/04_error-estimation.tex}
|
\input{parts/01_interpolation/01_trigonometric/04_error-estimation.tex}
|
||||||
|
|
||||||
|
% ── piece-wise interpolation ────────────────────────────────────────
|
||||||
|
\newsection
|
||||||
|
\section{Stückweise Polynomiale Interpolation}
|
||||||
|
\input{parts/01_interpolation/02_piece-wise/00_intro.tex}
|
||||||
|
\input{parts/01_interpolation/02_piece-wise/01_hermite-interpolation.tex}
|
||||||
|
\input{parts/01_interpolation/02_piece-wise/02_splines.tex}
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
@@ -1 +1,36 @@
|
|||||||
% Lecture: \chi here are used as RELU function!
|
% Lecture: \chi here are used as RELU function!
|
||||||
|
Globale Interpolation (also Interpolation auf dem ganzen Intervall $]-\infty, \infty[$) funktioniert nur dann gut, wenn:
|
||||||
|
\rmvspace
|
||||||
|
\begin{enumerate}[label=(\alph*), noitemsep]
|
||||||
|
\item die gegebenen Interpolationspunkte als Chebyshev-Knoten oder -Abszissen verwendet werden können
|
||||||
|
\item die Funktion glatt ist
|
||||||
|
\end{enumerate}
|
||||||
|
Es müssen beide obige Eigenschaften zutreffen.
|
||||||
|
Eine Idee um die Einschränkungen zu reduzieren oder komplett zu entfernen ist es, das Intervall zu unterteilen, oder formaler,
|
||||||
|
das Intervall $I = [a, b]$ in viele kleinere Intervalle zu zerlegen.
|
||||||
|
|
||||||
|
Wir haben dann ein Polynom vom Grad $n$ auf jedem Teilintervall mit $n + 1$ Punkten, was den Fehler verringert:
|
||||||
|
\begin{align*}
|
||||||
|
|f(x) - s(x)| < \frac{h^{n + 1}}{(n + 1)!} ||f^{(n + 1)}||_{\infty}
|
||||||
|
\end{align*}
|
||||||
|
|
||||||
|
Seien $N + 1$ Messpunkte gegeben. Wir verwenden sie als Knoten
|
||||||
|
(im Englischen \textit{breakpoints} gennant. Die Knoten sind also nicht dasselbe wie in den vorigen Kapiteln, es gibt aber keinen wirklich sinnvollen Namen im Deutschen)
|
||||||
|
diese $N + 1$ Messpunkte. Die Knoten dienen Paarweise als Abgrenzung der neuen, kleinen Intervalle, die wir erstellt haben.
|
||||||
|
Die linearen Interpolanten für jedes Intervall sind (mit $h_j = x_j - x_{j - 1}$):
|
||||||
|
\begin{align*}
|
||||||
|
s_j(x) = y_{j - 1}\frac{x_j - x}{h_j} + y_j \frac{x - x_{j - 1}}{h_j} \mediumhspace \text{für } x \in [x_{j - 1}, x_j]
|
||||||
|
\end{align*}
|
||||||
|
% NOTE: This might just be little more than a page in the script, but he talked about it for like 20 min in the lecture...
|
||||||
|
% and he even went as far as telling people to really pay attention...
|
||||||
|
% so I guess that means it is *not* important (could well not be important actually)
|
||||||
|
Wie man nun zu dieser Formel kommt:
|
||||||
|
Sei $\chi(t) = t \smallhspace \forall t \in [0, 1]$.
|
||||||
|
Die Funktion $f(t) = y_0 \chi(1 - t) + y_1 \chi(t)$ hat also die Interpolationseigenschaften $f(0) = y_0$ und $f(1) = y_1$ und ist linear in $t$.
|
||||||
|
Die Interpolation $s_j(x)$ auf $[x_{j - 1}, x_j]$ entsteht dann also aus $f$ mit Variablenwechsel $t = \frac{x - x_{j - 1}}{h_j} \in [0, 1] \leftrightarrow x = x_{j - 1} + h_j t$,
|
||||||
|
also gilt:
|
||||||
|
\begin{align*}
|
||||||
|
s_j(x) = y_{j - 1} \chi \left( \frac{x_j - x}{h_j} \right) + y_j \chi \left( \frac{x - x_{j - 1}}{h_j} \right) \mediumhspace \text{für } x \in [x_{j - 1}, x_j]
|
||||||
|
\end{align*}
|
||||||
|
Dies ist eine lokale Interpolation und $s_j$ ist $0$ ausser im definierten Intervall.
|
||||||
|
Die Idee des Variablenwechsel ist es, das Intervall, auf welchem die Funktion definiert ist von $[0, 1]$ nach $[x_{j - 1}, x_j]$ zu verschieben.
|
||||||
|
|||||||
@@ -1,2 +1,43 @@
|
|||||||
% 3rd order polynomial has 4 degrees of freedom (a, b, c and d), we have 4 coefficients for cubic hermite interpolation
|
\subsection{Kubische Hermite-Interpolation}
|
||||||
% CHIP algorithm ist formerhaltend
|
Die Kubische Hermite-Interpolation (CHIP) produziert eine auf $[a, b]$ stetig differenzierbare Funktion, welche auf den Teilintervallen $[x_{j - 1}, x_j]$ jeweils ein Polynom von Grad 3 ist.
|
||||||
|
Wichtige Eigenschaft von Polynomen $n$-ten Grades ist, dass sie $n + 1$ Freiheitsgrade haben (da sie $n + 1$ freie Variabeln enthalten).
|
||||||
|
|
||||||
|
Nutzen wir wieder das Konzept von oben, und wählen eine Funktion $\varphi(t) = t^2(3 - 2t)$ für $t \in [0, 1]$,
|
||||||
|
so erfüllt $f(t) = y_0\varphi(1 - t) + y_1 \varphi(t)$ wieder unsere Interpolationseigenschaften $f(0) = y_0$ und $f(1) = y_1$ und wir vollziehen denselben Variablenwechsel wie oben.
|
||||||
|
So erhalten wir:
|
||||||
|
\begin{align*}
|
||||||
|
p_j(x) = y_{j - 1} \varphi \left( \frac{x_j - x}{h_j} \right) + y_j \varphi \left( \frac{x - x_{j - 1}}{h_j} \right) \mediumhspace \text{für } x \in [x_{j - 1}, x_j]
|
||||||
|
\end{align*}
|
||||||
|
Wir haben folgende Ableitungen: $\varphi'(t) = 6t(1 - t)$, also sind die Nullstellen dieser Funktion bei $t \in \{ 0, 1 \}$,
|
||||||
|
weshalb auch die Ableitungen von $p_j$ an den Stellen $x_{j - 1}$ und $x_j$ verschwinden.
|
||||||
|
|
||||||
|
Für die Ableitungen definieren wir eine zweite Funktion $\psi(t) = t^2(t - 1)$, welche offensichtlich die Nullstellen an $t \in \{ 0, 1 \}$ hat
|
||||||
|
und deren Ableitung $\psi'(t) = t(3t - 2)$. Mit demselben Variablenwechsel müssen wir die Kettenregel beachten:
|
||||||
|
\begin{align*}
|
||||||
|
q_j(x) = c_{j - 1} h_j \psi \left( \frac{x - x_{j - 1}}{h_j} \right) - c_j h_j \psi \left( \frac{x_j - x}{h_j} \right) \mediumhspace \text{für } x \in [x_{j - 1}, x_j]
|
||||||
|
\end{align*}
|
||||||
|
Die Interpolationsfunktion ist dann einfach die Summe $s_j(x) = p_j(x) + q_j(x) \mediumhspace \text{für } x \in [x_{j - 1}, x_j]$
|
||||||
|
|
||||||
|
\fhlc{Cyan}{In Numpy} verwendet man \texttt{scipy.interpolate.Akima1DInterpolator} oder \texttt{PchipInterpolator}, welcher ``formerhaltender'' ist,
|
||||||
|
also wenn eine Funktion lokal monoton ist, so ist der Interpolant dort auch monoton.
|
||||||
|
Bei anderen Interpolationsmethoden ist dies nicht garantiert (so auch nicht beim \texttt{Akima1DInterpolator})
|
||||||
|
|
||||||
|
\begin{footnotesize}
|
||||||
|
\textit{Wenn man den Parameter \texttt{method="makima"} bei \texttt{Akima1DInterpolator} mitgibt, wird eine neuere modifizierte Variante davon ausgeführt}
|
||||||
|
\end{footnotesize}
|
||||||
|
|
||||||
|
\stepcounter{all}
|
||||||
|
\begin{theorem}[]{Fehler der CHIP}
|
||||||
|
% FIXME: Explain what the C is or if it is \C, then replace
|
||||||
|
Sei $f \in C^4[a, b]$ und $s$ der stückweise CHIP mit exakten Werten der Ableitungen $s'(x_j) = f'(x_j), s(x_j) = f(x_j)$ für $j = 0, \ldots, N$
|
||||||
|
% und sei $s_{|[x_{j - 1, x_j}]|}$ ein Polynom vom Grad $3$, für $j = 1, \ldots, N$.
|
||||||
|
und sei $s_j$ ein Polynom vom Grad $3$, für $j = 1, \ldots, N$. Dann gilt:
|
||||||
|
\rmvspace
|
||||||
|
\begin{align*}
|
||||||
|
||f^{(k)} - s^{(k)}||_{L^\infty} \leq \frac{1}{384} h^{4 - k} ||f^{(4)}||_{L^\infty}
|
||||||
|
\end{align*}
|
||||||
|
|
||||||
|
\rmvspace
|
||||||
|
mit $h = \max_{j = 1, \ldots, N} (x_j - x_{j - 1})$ und $k = 0, 1$
|
||||||
|
\end{theorem}
|
||||||
|
% FIXME: There is an important *looking* remark below this theorem... only issue... half of it is missing... Gemmini gobble gobble
|
||||||
|
|||||||
Reference in New Issue
Block a user