constant-functions.tex 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. \chapter{Constant functions}
  2. \section{Defined on $\mdr$}
  3. Let $f:\mdr \rightarrow \mdr$, $f(x) := c$ with $c \in \mdr$ be a constant function.
  4. \begin{figure}[htp]
  5. \centering
  6. \begin{tikzpicture}
  7. \begin{axis}[
  8. legend pos=north west,
  9. legend cell align=left,
  10. axis x line=middle,
  11. axis y line=middle,
  12. grid = major,
  13. width=0.8\linewidth,
  14. height=8cm,
  15. grid style={dashed, gray!30},
  16. xmin=-5, % start the diagram at this x-coordinate
  17. xmax= 5, % end the diagram at this x-coordinate
  18. ymin= 0, % start the diagram at this y-coordinate
  19. ymax= 3, % end the diagram at this y-coordinate
  20. axis background/.style={fill=white},
  21. xlabel=$x$,
  22. ylabel=$y$,
  23. tick align=outside,
  24. minor tick num=-3,
  25. enlargelimits=true,
  26. tension=0.08]
  27. \addplot[domain=-5:5, thick,samples=50, red] {1};
  28. \addplot[domain=-5:5, thick,samples=50, green] {2};
  29. \addplot[domain=-5:5, thick,samples=50, blue, densely dotted] {3};
  30. \addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 2)};
  31. \addplot[blue, mark = *, nodes near coords=$P_{h,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(2, 3)};
  32. \addplot[green, mark = x, nodes near coords=$P_{g,\text{min}}$,every node near coord/.style={anchor=120}] coordinates {(2, 2)};
  33. \addplot[red, mark = *, nodes near coords=$P_{f,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(2, 1)};
  34. \draw[thick, dashed] (axis cs:2,0) -- (axis cs:2,3);
  35. \addlegendentry{$f(x)=1$}
  36. \addlegendentry{$g(x)=2$}
  37. \addlegendentry{$h(x)=3$}
  38. \end{axis}
  39. \end{tikzpicture}
  40. \caption{Three constant functions and their points with minimal distance}
  41. \label{fig:constant-min-distance}
  42. \end{figure}
  43. Then $(x_P,f(x_P))$ has
  44. minimal distance to $P$. Every other point has higher distance.
  45. See Figure~\ref{fig:constant-min-distance}.
  46. This means:
  47. \[S_0(f, P) = \Set{x_P} \text{ with } P = (x_P, y_P)\]
  48. \clearpage
  49. \section{Defined on a closed interval $[a,b] \subseteq \mdr$}
  50. Let $f:[a,b] \rightarrow \mdr$, $f(x) := c$ with $a,b,c \in \mdr$ and
  51. $a \leq b$ be a constant function.
  52. \begin{figure}[htp]
  53. \centering
  54. \begin{tikzpicture}
  55. \begin{axis}[
  56. legend pos=north west,
  57. legend cell align=left,
  58. axis x line=middle,
  59. axis y line=middle,
  60. grid = major,
  61. width=0.8\linewidth,
  62. height=8cm,
  63. grid style={dashed, gray!30},
  64. xmin=-5, % start the diagram at this x-coordinate
  65. xmax= 5, % end the diagram at this x-coordinate
  66. ymin= 0, % start the diagram at this y-coordinate
  67. ymax= 3, % end the diagram at this y-coordinate
  68. axis background/.style={fill=white},
  69. xlabel=$x$,
  70. ylabel=$y$,
  71. tick align=outside,
  72. minor tick num=-3,
  73. enlargelimits=true,
  74. tension=0.08]
  75. \addplot[domain=-5:-2, thick,samples=50, red] {1};
  76. \addplot[domain=-1:3, thick,samples=50, green] {1.5};
  77. \addplot[domain=3:5, thick,samples=50, blue, densely dotted] {3};
  78. \addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 2)};
  79. \addplot[blue, mark = *, nodes near coords=$P_{h,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(3, 3)};
  80. \addplot[green, mark = x, nodes near coords=$P_{g,\text{min}}$,every node near coord/.style={anchor=120}] coordinates {(2, 1.5)};
  81. \addplot[red, mark = *, nodes near coords=$P_{f,\text{min}}$,every node near coord/.style={anchor=225}] coordinates {(-2, 1)};
  82. \draw[thick, dashed] (axis cs:2,1.5) -- (axis cs:2,2);
  83. \draw[thick, dashed] (axis cs:2,2) -- (axis cs:-2,1);
  84. \draw[thick, dashed] (axis cs:2,2) -- (axis cs:3,3);
  85. \addlegendentry{$f(x)=1, D = [-5,-2]$}
  86. \addlegendentry{$g(x)=1.5, D = [-1,3]$}
  87. \addlegendentry{$h(x)=3, D = [3,5]$}
  88. \end{axis}
  89. \end{tikzpicture}
  90. \caption{Three constant functions and their points with minimal distance}
  91. \label{fig:constant-min-distance-closed-intervall}
  92. \end{figure}
  93. The point with minimum distance can be found by:
  94. \[\underset{x\in\mdr}{\arg \min d_{P,f}(x)} = \begin{cases}
  95. S_0(f,P) &\text{if } S_0(f,P) \cap [a,b] \neq \emptyset \\
  96. \Set{a} &\text{if } S_0(f,P) \ni x_P < a\\
  97. \Set{b} &\text{if } S_0(f,P) \ni x_P > b
  98. \end{cases}\]