math-minimal-distance-to-cubic-function.tex 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. \documentclass[a4paper]{scrartcl}
  2. \usepackage{amssymb, amsmath} % needed for math
  3. \usepackage[utf8]{inputenc} % this is needed for umlauts
  4. \usepackage[english]{babel} % this is needed for umlauts
  5. \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
  6. \usepackage[margin=2.5cm]{geometry} %layout
  7. \usepackage{hyperref} % links im text
  8. \usepackage{braket} % needed for \Set
  9. \usepackage{parskip}
  10. \usepackage[colorinlistoftodos]{todonotes}
  11. \usepackage{pgfplots}
  12. \pgfplotsset{compat=1.7,compat/path replacement=1.5.1}
  13. \usepackage{tikz}
  14. \title{Minimal distance to a cubic function}
  15. \author{Martin Thoma}
  16. \hypersetup{
  17. pdfauthor = {Martin Thoma},
  18. pdfkeywords = {},
  19. pdftitle = {Minimal Distance}
  20. }
  21. \def\mdr{\ensuremath{\mathbb{R}}}
  22. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  23. % Begin document %
  24. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  25. \begin{document}
  26. \maketitle
  27. \begin{abstract}
  28. In this paper I want to discuss how to find all points on a a cubic
  29. function with minimal distance to a given point.
  30. \end{abstract}
  31. \section{Description of the Problem}
  32. Let $f: \mdr \rightarrow \mdr$ be a polynomial function and $P \in \mdr^2$
  33. be a point. Let $d: \mdr^2 \times \mdr^2 \rightarrow \mdr_0^+$
  34. be the euklidean distance of two points:
  35. \[d \left ((x_1, y_1), (x_2, y_2) \right) := \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}\]
  36. Now there is finite set of points $x_1, \dots, x_n$ such that
  37. \[\forall \tilde x \in \mathbb{R} \setminus \{x_1, \dots, x_n\}: d(P, (x_1, f(x_1))) = \dots = d(P, (x_n, f(x_n))) < d(P, (\tilde x, f(\tilde x)))\]
  38. \section{Minimal distance to a constant function}
  39. Let $f(x) = c$ with $c \in \mdr$ be a function.
  40. \todo[inline]{add image}
  41. Then $(x_P,f(x_P))$ has
  42. minimal distance to $P$. Every other point has higher distance.
  43. \section{Minimal distance to a linear function}
  44. Let $f(x) = m \cdot x + t$ with $m \in \mdr \setminus \Set{0}$ and
  45. $t \in \mdr$ be a function.
  46. \todo[inline]{add image}
  47. Now you can drop a perpendicular through $P$ on $f(x)$. The slope $f_\bot$
  48. of the perpendicular is $- \frac{1}{m}$. Then:
  49. \begin{align}
  50. f_\bot(x) &= - \frac{1}{m} \cdot x + t_\bot\\
  51. \Rightarrow y_P &= - \frac{1}{m} \cdot x_P + t_\bot\\
  52. \Leftrightarrow t_\bot &= y_P + \frac{1}{m} \cdot x_P\\
  53. f(x) &= f_\bot(x)\\
  54. \Leftrightarrow m \cdot x + t &= - \frac{1}{m} \cdot x + \left(y_P + \frac{1}{m} \cdot x_P \right)\\
  55. \Leftrightarrow \left (m + \frac{1}{m} \right ) \cdot x &= y_P + \frac{1}{m} \cdot x_P - t\\
  56. \Leftrightarrow x &= \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )
  57. \end{align}
  58. There is only one point with minimal distance.
  59. \section{Minimal distance to a quadratic function}
  60. Let $f(x) = a \cdot x^2 + b \cdot x + c$ with $a \in \mdr \setminus \Set{0}$ and
  61. $b, c \in \mdr$ be a function.
  62. \begin{figure}[htp]
  63. \centering
  64. \begin{tikzpicture}
  65. \begin{axis}[
  66. legend pos=north west,
  67. axis x line=middle,
  68. axis y line=middle,
  69. grid = major,
  70. width=0.8\linewidth,
  71. height=8cm,
  72. grid style={dashed, gray!30},
  73. xmin=-3, % start the diagram at this x-coordinate
  74. xmax= 3, % end the diagram at this x-coordinate
  75. ymin=-0.25, % start the diagram at this y-coordinate
  76. ymax= 9, % end the diagram at this y-coordinate
  77. axis background/.style={fill=white},
  78. xlabel=$x$,
  79. ylabel=$y$,
  80. %xticklabels={-2,-1.6,...,7},
  81. %yticklabels={-8,-7,...,8},
  82. tick align=outside,
  83. minor tick num=-3,
  84. enlargelimits=true,
  85. tension=0.08]
  86. \addplot[domain=-3:3, thick,samples=50, red] {0.5*x*x};
  87. \addplot[domain=-3:3, thick,samples=50, green] {x*x};
  88. \addplot[domain=-3:3, thick,samples=50, blue] {x*x + x};
  89. \addplot[domain=-3:3, thick,samples=50, orange] {x*x + 2*x};
  90. \addplot[domain=-3:3, thick,samples=50, black] {-x*x + 6};
  91. \addlegendentry{$f_1(x)=\frac{1}{2}x^2$}
  92. \addlegendentry{$f_2(x)=x^2$}
  93. \addlegendentry{$f_3(x)=x^2+x$}
  94. \addlegendentry{$f_4(x)=x^2+2x$}
  95. \addlegendentry{$f_5(x)=-x^2+6$}
  96. \end{axis}
  97. \end{tikzpicture}
  98. \caption{Quadratic functions}
  99. \end{figure}
  100. \subsection{Number of points with minimal distance}
  101. It is obvious that a quadratic function can have two points with
  102. minimal distance.
  103. For example, let $f(x) = x^2$ and $P = (0,5)$. Then $P_{f,1} \approx (2.179, 2.179^2)$
  104. has minimal distance to $P$, but also $P_{f,2}\approx (-2.179, 2.179^2)$.
  105. Obviously, there cannot be more than three points with minimal distance.
  106. But can there be three points?
  107. \begin{figure}[htp]
  108. \centering
  109. \begin{tikzpicture}
  110. \begin{axis}[
  111. legend pos=north west,
  112. axis x line=middle,
  113. axis y line=middle,
  114. grid = major,
  115. width=0.8\linewidth,
  116. height=8cm,
  117. grid style={dashed, gray!30},
  118. xmin=-0.7, % start the diagram at this x-coordinate
  119. xmax= 0.7, % end the diagram at this x-coordinate
  120. ymin=-0.25, % start the diagram at this y-coordinate
  121. ymax= 0.5, % end the diagram at this y-coordinate
  122. axis background/.style={fill=white},
  123. xlabel=$x$,
  124. ylabel=$y$,
  125. %xticklabels={-2,-1.6,...,7},
  126. %yticklabels={-8,-7,...,8},
  127. tick align=outside,
  128. minor tick num=-3,
  129. enlargelimits=true,
  130. tension=0.08]
  131. \addplot[domain=-0.7:0.7, thick,samples=50, orange] {x*x};
  132. \draw (axis cs:0,0.5) circle[radius=0.5];
  133. \draw[red, thick] (axis cs:0,0.5) -- (axis cs:0.101,0.0102);
  134. \draw[red, thick] (axis cs:0,0.5) -- (axis cs:-0.101,0.0102);
  135. \draw[red, thick] (axis cs:0,0.5) -- (axis cs:0,0);
  136. \addlegendentry{$f(x)=x^2$}
  137. \end{axis}
  138. \end{tikzpicture}
  139. \caption{3 points with minimal distance?}
  140. \todo[inline]{Is this possible?}
  141. \end{figure}
  142. \subsection{Calculate points with minimal distance}
  143. \todo[inline]{Write this}
  144. \section{Minimal distance to a cubic function}
  145. \subsection{Number of points with minimal distance}
  146. \todo[inline]{Write this}
  147. \subsection{Calculate points with minimal distance}
  148. \todo[inline]{Write this}
  149. \end{document}