2013-12-12 16:22:13 +01:00
|
|
|
\chapter{Constant functions}
|
|
|
|
\section{Defined on $\mdr$}
|
2013-12-12 23:05:04 +01:00
|
|
|
Let $f:\mdr \rightarrow \mdr$, $f(x) := c$ with $c \in \mdr$ be a constant function.
|
2013-12-16 10:51:15 +01:00
|
|
|
The situation can be seen in Figure~\ref{fig:constant-min-distance}.
|
2013-12-12 16:22:13 +01:00
|
|
|
|
|
|
|
\begin{figure}[htp]
|
|
|
|
\centering
|
|
|
|
\begin{tikzpicture}
|
|
|
|
\begin{axis}[
|
|
|
|
legend pos=north west,
|
2013-12-12 23:05:04 +01:00
|
|
|
legend cell align=left,
|
2013-12-12 16:22:13 +01:00
|
|
|
axis x line=middle,
|
|
|
|
axis y line=middle,
|
|
|
|
grid = major,
|
|
|
|
width=0.8\linewidth,
|
|
|
|
height=8cm,
|
|
|
|
grid style={dashed, gray!30},
|
|
|
|
xmin=-5, % start the diagram at this x-coordinate
|
|
|
|
xmax= 5, % end the diagram at this x-coordinate
|
|
|
|
ymin= 0, % start the diagram at this y-coordinate
|
|
|
|
ymax= 3, % end the diagram at this y-coordinate
|
|
|
|
axis background/.style={fill=white},
|
|
|
|
xlabel=$x$,
|
|
|
|
ylabel=$y$,
|
|
|
|
tick align=outside,
|
|
|
|
minor tick num=-3,
|
|
|
|
enlargelimits=true,
|
|
|
|
tension=0.08]
|
|
|
|
\addplot[domain=-5:5, thick,samples=50, red] {1};
|
|
|
|
\addplot[domain=-5:5, thick,samples=50, green] {2};
|
|
|
|
\addplot[domain=-5:5, thick,samples=50, blue, densely dotted] {3};
|
|
|
|
\addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 2)};
|
|
|
|
\addplot[blue, mark = *, nodes near coords=$P_{h,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(2, 3)};
|
|
|
|
\addplot[green, mark = x, nodes near coords=$P_{g,\text{min}}$,every node near coord/.style={anchor=120}] coordinates {(2, 2)};
|
|
|
|
\addplot[red, mark = *, nodes near coords=$P_{f,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(2, 1)};
|
|
|
|
\draw[thick, dashed] (axis cs:2,0) -- (axis cs:2,3);
|
|
|
|
\addlegendentry{$f(x)=1$}
|
|
|
|
\addlegendentry{$g(x)=2$}
|
|
|
|
\addlegendentry{$h(x)=3$}
|
|
|
|
\end{axis}
|
|
|
|
\end{tikzpicture}
|
|
|
|
\caption{Three constant functions and their points with minimal distance}
|
|
|
|
\label{fig:constant-min-distance}
|
|
|
|
\end{figure}
|
|
|
|
|
2013-12-16 10:51:15 +01:00
|
|
|
\begin{align}
|
|
|
|
d_{P,f}(x) &= \sqrt{(x_P - x)^2 + (y_P - f(x))^2}\\
|
|
|
|
&= \sqrt{(x_P^2 - 2x_P x + x^2) + (y_P^2 - 2 y_P c + c^2)} \\
|
|
|
|
&= \sqrt{x^2 - 2 x_P x + (x_P^2 + y_P^2 - 2 y_P c + c^2)}\label{eq:constant-function-distance}\\
|
|
|
|
\xRightarrow{\text{Theorem}~\ref{thm:fermats-theorem}} 0 &\stackrel{!}{=} (d_{P,f}(x)^2)'\\
|
|
|
|
&= 2x - 2x_P\\
|
|
|
|
\Leftrightarrow x &\stackrel{!}{=} x_P
|
|
|
|
\end{align}
|
|
|
|
|
2013-12-12 16:22:13 +01:00
|
|
|
Then $(x_P,f(x_P))$ has
|
|
|
|
minimal distance to $P$. Every other point has higher distance.
|
2013-12-16 10:51:15 +01:00
|
|
|
See Figure~\ref{fig:constant-min-distance} to see that intuition
|
|
|
|
yields to the same results.
|
2013-12-12 16:22:13 +01:00
|
|
|
|
2013-12-16 10:51:15 +01:00
|
|
|
This result means:
|
2013-12-12 23:05:04 +01:00
|
|
|
|
|
|
|
\[S_0(f, P) = \Set{x_P} \text{ with } P = (x_P, y_P)\]
|
|
|
|
\clearpage
|
|
|
|
|
|
|
|
\section{Defined on a closed interval $[a,b] \subseteq \mdr$}
|
|
|
|
Let $f:[a,b] \rightarrow \mdr$, $f(x) := c$ with $a,b,c \in \mdr$ and
|
|
|
|
$a \leq b$ be a constant function.
|
|
|
|
|
|
|
|
\begin{figure}[htp]
|
|
|
|
\centering
|
|
|
|
\begin{tikzpicture}
|
|
|
|
\begin{axis}[
|
|
|
|
legend pos=north west,
|
|
|
|
legend cell align=left,
|
|
|
|
axis x line=middle,
|
|
|
|
axis y line=middle,
|
|
|
|
grid = major,
|
|
|
|
width=0.8\linewidth,
|
|
|
|
height=8cm,
|
|
|
|
grid style={dashed, gray!30},
|
|
|
|
xmin=-5, % start the diagram at this x-coordinate
|
|
|
|
xmax= 5, % end the diagram at this x-coordinate
|
|
|
|
ymin= 0, % start the diagram at this y-coordinate
|
|
|
|
ymax= 3, % end the diagram at this y-coordinate
|
|
|
|
axis background/.style={fill=white},
|
|
|
|
xlabel=$x$,
|
|
|
|
ylabel=$y$,
|
|
|
|
tick align=outside,
|
|
|
|
minor tick num=-3,
|
|
|
|
enlargelimits=true,
|
|
|
|
tension=0.08]
|
|
|
|
\addplot[domain=-5:-2, thick,samples=50, red] {1};
|
|
|
|
\addplot[domain=-1:3, thick,samples=50, green] {1.5};
|
|
|
|
\addplot[domain=3:5, thick,samples=50, blue, densely dotted] {3};
|
|
|
|
\addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 2)};
|
|
|
|
|
|
|
|
\addplot[blue, mark = *, nodes near coords=$P_{h,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(3, 3)};
|
|
|
|
\addplot[green, mark = x, nodes near coords=$P_{g,\text{min}}$,every node near coord/.style={anchor=120}] coordinates {(2, 1.5)};
|
|
|
|
\addplot[red, mark = *, nodes near coords=$P_{f,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(-2, 1)};
|
|
|
|
|
|
|
|
\draw[thick, dashed] (axis cs:2,1.5) -- (axis cs:2,2);
|
|
|
|
\draw[thick, dashed] (axis cs:2,2) -- (axis cs:-2,1);
|
|
|
|
\draw[thick, dashed] (axis cs:2,2) -- (axis cs:3,3);
|
|
|
|
\addlegendentry{$f(x)=1, D = [-5,-2]$}
|
|
|
|
\addlegendentry{$g(x)=1.5, D = [-1,3]$}
|
|
|
|
\addlegendentry{$h(x)=3, D = [3,5]$}
|
|
|
|
\end{axis}
|
|
|
|
\end{tikzpicture}
|
|
|
|
\caption{Three constant functions and their points with minimal distance}
|
|
|
|
\label{fig:constant-min-distance-closed-intervall}
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
The point with minimum distance can be found by:
|
|
|
|
\[\underset{x\in\mdr}{\arg \min d_{P,f}(x)} = \begin{cases}
|
|
|
|
S_0(f,P) &\text{if } S_0(f,P) \cap [a,b] \neq \emptyset \\
|
|
|
|
\Set{a} &\text{if } S_0(f,P) \ni x_P < a\\
|
|
|
|
\Set{b} &\text{if } S_0(f,P) \ni x_P > b
|
|
|
|
\end{cases}\]
|
2013-12-16 11:56:21 +01:00
|
|
|
|
|
|
|
Because:
|
|
|
|
\begin{align}
|
|
|
|
\underset{x\in[a,b]}{\arg \min d_{P,f}(x)} &= \underset{x\in[a,b]}{\arg \min d_{P,f}(x)^2}\\
|
|
|
|
&=\underset{x\in[a,b]}{\arg \min} x^2 - 2x_P x + (x_P^2 + y_P^2 - 2 y_P c + c^2)\\
|
|
|
|
&=\underset{x\in[a,b]}{\arg \min} x^2 - 2 x_P x + x_P^2\\
|
|
|
|
&=\underset{x\in[a,b]}{\arg \min} (x-x_P)^2
|
|
|
|
\end{align}
|