فهرست منبع

Änderungen der Zugfahrt eingearbeitet.

Martin Thoma 11 سال پیش
والد
کامیت
102fe0447b

+ 13 - 10
documents/math-minimal-distance-to-cubic-function/constant-functions.tex

@@ -1,8 +1,13 @@
 \chapter{Constant functions}
 \section{Defined on $\mdr$}
+\begin{lemma}
 Let $f:\mdr \rightarrow \mdr$, $f(x) := c$ with $c \in \mdr$ be a constant function. 
-The situation can be seen in Figure~\ref{fig:constant-min-distance}.
 
+Then $(x_P, f(x_P))$ is the only point on the graph of $f$ with 
+minimal distance to $P$.
+\end{lemma}
+
+The situation can be seen in Figure~\ref{fig:constant-min-distance}.
 \begin{figure}[htp]
     \centering
     \begin{tikzpicture}
@@ -43,20 +48,19 @@ The situation can be seen in Figure~\ref{fig:constant-min-distance}.
     \label{fig:constant-min-distance}
 \end{figure}
 
+\begin{proof}
 The point $(x, f(x))$ with minimal distance can be calculated directly:
 \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}\\
+    d_{P,f}(x) &= \sqrt{(x - x_P)^2 + (f(x) - y_P)^2}\\
+               &= \sqrt{(x^2 - 2x_P x + x_P^2) + (c^2 - 2 c y_P + y_P^2)} \\
+               &= \sqrt{x^2 - 2 x_P x + (x_P^2 + c^2 - 2 c y_P + y_P^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}
 
-Then $(x_P,f(x_P))$ has
-minimal distance to $P$. Every other point has higher distance.
-See Figure~\ref{fig:constant-min-distance} to see that intuition
-yields to the same results.
+So $(x_P,f(x_P))$ is the only point with minimal distance to $P$. $\qed$
+\end{proof}
 
 This result means:
 
@@ -124,8 +128,7 @@ given by:
 \begin{proof}
 \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} \big (x^2 - 2x_P x + x_P^2 + \overbrace{(y_P^2 - 2 y_P c + c^2)}^{\text{constant}} \big )\\
-   &=\underset{x\in[a,b]}{\arg \min} (x^2 - 2 x_P x + x_P^2)\\
+   &=\underset{x\in[a,b]}{\arg \min} \big ((x-x_P)^2 + \overbrace{(y_P^2 - 2 y_P c + c^2)}^{\text{constant}} \big )\\
    &=\underset{x\in[a,b]}{\arg \min} (x-x_P)^2
 \end{align}
 

+ 29 - 22
documents/math-minimal-distance-to-cubic-function/cubic-functions.tex

@@ -1,8 +1,8 @@
 \chapter{Cubic functions}
 \section{Defined on $\mdr$}
-Let $f(x) = a \cdot x^3 + b \cdot x^2 + c \cdot x + d$ be a cubic function
-with $a \in \mdr \setminus \Set{0}$ and 
-$b, c, d \in \mdr$ be a function.
+Let $f:\mdr \rightarrow \mdr, f(x) = a \cdot x^3 + b \cdot x^2 + c \cdot x + d$ 
+be a cubic function with $a \in \mdr \setminus \Set{0}$ and 
+$b, c, d \in \mdr$.
 
 \begin{figure}[htp]
     \centering
@@ -50,8 +50,8 @@ $b, c, d \in \mdr$ be a function.
 %\todo[inline]{Write this}
 
 \subsection{Calculate points with minimal distance}
-\begin{theorem}
-    There cannot be an algebraic solution to the problem of finding 
+\begin{theorem}\label{thm:no-finite-solution}
+    There cannot be a finite, closed form solution to the problem of finding 
     a closest point $(x, f(x))$ to a given point $P$ when $f$ is
     a polynomial function of degree $3$ or higher.
 \end{theorem}
@@ -71,29 +71,29 @@ $b, c, d \in \mdr$ be a function.
 
     General algebraic equations of degree 5 don't have a solution formula.\footnote{TODO: Quelle}
     Although here seems to be more structure, the resulting algebraic
-    equation can be almost any polynomial of degree 5:\footnote{Thanks to Peter Košinár on \href{http://math.stackexchange.com/a/584814/6876}{math.stackexchange.com} for this one}
+    equation can be almost any polynomial of degree 5:\footnote{Thanks to Peter Košinár on \href{http://math.stackexchange.com/a/584814/6876}{math.stackexchange.com} for the idea.}
 
     \begin{align}
         0  &\stackrel{!}{=} f'(x) \cdot \left (f(x) - y_p \right ) + (x - x_p)\\
-        &= \underbrace{3 a^2}_{= \tilde{a}} x^5 + \underbrace{5ab}_{\tilde{b}}x^4 + \underbrace{2(2ac + b^2 )}_{=: \tilde{c}}x^3 &+& \underbrace{3(ad+bc-ay_p)}_{\tilde{d}} x^2 \\
-        & &+& \underbrace{(2 b d+c^2+1-2 b y_p)}_{=: \tilde{e}}x+\underbrace{c d-c y_p-x_p}_{=: \tilde{f}}\\
+        &= \underbrace{3 a^2}_{= \tilde{a}} x^5 + \underbrace{5ab}_{= \tilde{b}}x^4 + \underbrace{2(2ac + b^2 )}_{= \tilde{c}}x^3 &+& \underbrace{3(ad+bc-ay_p)}_{= \tilde{d}} x^2 \\
+        & &+& \underbrace{(2 b d+c^2+1-2 b y_p)}_{= \tilde{e}}x+\underbrace{c d-c y_p-x_p}_{= \tilde{f}}\\
         0 &\stackrel{!}{=} \tilde{a}x^5 + \tilde{b}x^4 + \tilde{c}x^3 + \tilde{d}x^2 + \tilde{e}x + \tilde{f}
     \end{align}
 
     \begin{enumerate}
-        \item For any coefficient $\tilde{a} \in \mdr_{> 0}$ of $x^5$ we can choose $a$ such that we get $\tilde{a}$.
-        \item For any coefficient $\tilde{b} \in \mdr \setminus \Set{0}$ of $x^4$ we can choose $b$ such that we get $\tilde{b}$.
-        \item With $c$, we can get any value of $\tilde{c} \in \mdr$.
-        \item With $d$, we can get any value of $\tilde{d} \in \mdr$.
-        \item With $y_p$, we can get any value of $\tilde{e} \in \mdr$.
-        \item With $x_p$, we can get any value of $\tilde{f} \in \mdr$.
+        \item For any coefficient $\tilde{a} \in \mdr_{> 0}$ of $x^5$ we can choose $a := \frac{1}{3} \sqrt{\tilde{a}}$ such that we get $\tilde{a}$.
+        \item For any coefficient $\tilde{b} \in \mdr \setminus \Set{0}$ of $x^4$ we can choose $b := \frac{1}{5a} \cdot \tilde{b}$ such that we get $\tilde{b}$.
+        \item With $c := -2b^2 + \frac{1}{4a} \tilde{c}$, we can get any value of $\tilde{c} \in \mdr$.
+        \item With $d := -bc + a y_p + \frac{1}{a} \tilde{d}$, we can get any value of $\tilde{d} \in \mdr$.
+        \item With $y_p := \frac{1}{2b}(2bd + c^2)\cdot \tilde{e}$, we can get any value of $\tilde{e} \in \mdr$.
+        \item With $x_p := cd - c y_P+\tilde{f}$, we can get any value of $\tilde{f} \in \mdr$.
     \end{enumerate}
 
     The first restriction guaratees that we have a polynomial of 
     degree 5. The second one is necessary, to get a high range of
     $\tilde{e}$.
 
-    This means, that there is no solution formula for the problem of 
+    This means that there is no finite solution formula for the problem of 
     finding the closest points on a cubic function to a given point,
     because if there was one, you could use this formula for finding
     roots of polynomials of degree 5. $\qed$
@@ -101,9 +101,6 @@ $b, c, d \in \mdr$ be a function.
 
 
 \subsection{Another approach}
-\todo[inline]{Currently, this is only an idea. It might be usefull
-to move the cubic function $f$ such that $f$ is point symmetric
-to the origin. But I'm not sure how to make use of this symmetry.}
 Just like we moved the function $f$ and the point to get in a 
 nicer situation, we can apply this approach for cubic functions.
 
@@ -144,7 +141,7 @@ nicer situation, we can apply this approach for cubic functions.
     \caption{Cubic functions with $b = d = 0$}
 \end{figure}
 
-First, we move $f_0$ by $\frac{b}{3a}$ to the right, so
+First, we move $f_0$ by $\frac{b}{3a}$ in $x$ direction, so
 
 \[f_1(x) = ax^3 + \frac{b^2 (c-1)}{3a} x + \frac{2b^3}{27 a^2} - \frac{bc}{3a} + d \;\;\;\text{ and }\;\;\;P_1 = (x_P + \frac{b}{3a}, y_P)\]
 
@@ -161,6 +158,19 @@ because
             &= ax^3 + \frac{b^2}{3a}\left (1-2+c \right )x + \frac{b^3}{9a^2} \left (1-\frac{1}{3} \right )- \frac{bc}{3a} + d
 \end{align}
 
+The we move it in $y$ direction by $- (\frac{2b^3}{27 a^2} - \frac{bc}{3a} + d)$:
+
+\[f_2(x) = ax^3 + \frac{b^2 (c-1)}{3a} x \;\;\;\text{ and }\;\;\;P_2 = (x_P + \frac{b}{3a}, y_P - (\frac{2b^3}{27 a^2} - \frac{bc}{3a} + d))\]
+
+Multiply everything by $\sgn(a)$:
+
+\[f_3(x) = \underbrace{|a|}_{=: \alpha}x^3 + \underbrace{\frac{b^2 (c-1)}{3|a|}}_{=: \beta} x \;\;\;\text{ and }\;\;\;P_2 = (x_P + \frac{b}{3a}, \sgn(a) (y_P - \frac{2b^3}{27 a^2} + \frac{bc}{3a} - d))\]
+
+Now the problem seems to be much simpler. The function $\alpha x^3 + \beta x$
+with $\alpha > 0$ is centrally symmetric to $(0, 0)$.
+
+\todo[inline]{Und weiter?}
+
 \subsection{Number of points with minimal distance}
 As this leads to a polynomial of degree 5 of which we have to find
 roots, there cannot be more than 5 solutions.
@@ -211,9 +221,6 @@ As soon as the values don't change much, you are close to a root.
 The problem of this approach is choosing a starting value that is
 close enough to the root. So we have to have a \enquote{good}
 initial guess.
-
-\subsubsection{Quadratic minimization}
-\todo[inline]{TODO}
 \clearpage
 
 \subsubsection{Muller's method}

+ 2 - 3
documents/math-minimal-distance-to-cubic-function/introduction.tex

@@ -7,9 +7,8 @@ is by applying the \href{https://en.wikipedia.org/wiki/PID_algorithm}{PID algori
 This algorithm needs to know the signed current error. So you need to 
 be able to get the minimal distance of a point (the position of the car)
 to a cubic spline (the prefered path)
-combined with the direction (left or right).
-As you need to get the signed error (and one steering direction might
-be prefered), it is not only necessary to
+combined with sign (which represents the steering direction).
+As one steering direction might be prefered, it is not only necessary to
 get the minimal absolute distance, but might also help to get all points
 on the spline with minimal distance.
 

+ 41 - 3
documents/math-minimal-distance-to-cubic-function/linear-functions.tex

@@ -5,7 +5,8 @@
     $f(x) := m \cdot x + t$ with $m \in \mdr \setminus \Set{0}$ and 
     $t \in \mdr$ be a linear function.
 
-    Then the points $(x, f(x))$ with minimal distance are given by:
+    Then there is only one point $(x, f(x))$ on the graph of $f$ with
+    minimal distance to $P = (x_P, y_P)$. This point is given by
     \[x = \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\]
 \end{theorem}
 
@@ -35,6 +36,8 @@
           \addplot[domain=-5:5, thick,samples=50, red] {0.5*x};
           \addplot[domain=-5:5, thick,samples=50, blue, dashed] {-2*x+6};
           \addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 2)};
+          \newcommand{\R}{0.9}
+          \addplot [domain=0:2*pi,samples=50, dotted]({\R*cos(deg(x))+2},{\R*sin(deg(x))+2});
           \addplot[blue, nodes near coords=$f_\bot$,every node near coord/.style={anchor=225}] coordinates {(1.5, 3)};
           \addplot[red, nodes near coords=$f$,every node near coord/.style={anchor=225}] coordinates {(0.9, 0.5)};
           \addlegendentry{$f(x)=\frac{1}{2}x$}
@@ -57,7 +60,7 @@
         &= \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\label{eq:solution-linear-r}
     \end{align}
     It is obvious that a minium has to exist, the $x$ from Equation~\ref{eq:solution-linear-r}
-    has to be this minimum.
+    has to be this minimum. $\qed$
 \end{proof}
 \clearpage
 
@@ -113,4 +116,39 @@ The point with minimum distance can be found by:
    \Set{b} &\text{if } S_1(f, P) \ni x > b
     \end{cases}\]
 
-\todo[inline]{argument? proof?}
+If $S_1(f, P) \cap [a,b] \neq \emptyset$, then $\underset{x\in[a,b]}{\arg \min d_{P,f}(x)} = S_1(f,P) \cap [a,b]$,
+because $S_1(f,P)$ gives all global minima of $f$. Those are also
+minima for the intervall $[a,b]$. There are not more minima, because
+$S_1$ gives all minima of $P$ to $f$.
+
+If $S_1(f, P) \cap [a,b] = \emptyset$, then it is not that simple. 
+But we can calculate the distance function:
+
+\begin{align}
+    d_{P,f}(x) &= \sqrt{(x-x_P)^2 + (f(x) - y_P)^2}\\
+    &= \sqrt{(x^2 - 2x x_P + x_P^2) + (mx + (t-y_P))^2}\\
+    &= \sqrt{(x^2 - 2x x_P + x_P^2) + m^2 x^2 + 2mx(t-y_P) + (t-y_P)^2}\\
+    &= \sqrt{x^2(1+m^2) + x(-2 x_P + 2m(t-y_P)) + (x_P^2 + (t-y_P)^2)}
+\end{align}
+
+This function (defined on $\mdr$) is symmetry to the axis 
+\begin{align}
+    x_S &= - \frac{-2 x_P + 2m(t-y_P)}{2(1+m^2)}\\
+    &= \frac{x_P - m(t-y_P)}{1+m^2}\\
+    &= \frac{m}{m^2+1} (y_P + \frac{1}{m} x_P - t)
+\end{align}
+
+$f$ is on $(-\infty, x_S]$ strictly monotonically decreasing and
+on $[x_S, + \infty)$ strictly monotonically increasing.
+
+Thus we can conclude: 
+\[\forall x,y \in \mdr: x \leq y < x_S \Rightarrow d_{P,f}(x_S) < d_{P,f}(y) \leq d_{P,f}(x)\]
+\[\forall x,y \in \mdr: x_S < y \leq x \Rightarrow d_{P,f}(x_S) < d_{P,f}(y) \leq d_{P,f}(x)\]
+
+When $S_1(f, P) \cap [a,b] = \emptyset$, then you can have two cases:
+\begin{itemize}
+    \item $a \leq b < x_S$: $b$ has the shortest distance in $[a,b]$
+             on the graph of $f$ to $P$.
+    \item $x_S < a \leq b$: $a$ has the shortest distance in $[a,b]$ 
+             on the graph of $f$ to $P$.
+\end{itemize}

BIN
documents/math-minimal-distance-to-cubic-function/math-minimal-distance-to-cubic-function.pdf


+ 11 - 6
documents/math-minimal-distance-to-cubic-function/problem-description.tex

@@ -9,9 +9,9 @@ Now there is finite set $M = \Set{x_1, \dots, x_n} \subseteq D$ of minima for gi
 \[M = \Set{x \in D | d_{P,f}(x) = \min_{\overline{x} \in D} d_{P,f}(\overline{x})}\] 
 
 But minimizing $d_{P,f}$ is the same as minimizing 
-$d_{P,f}^2 = x_p^2 - 2x_p x + x^2 + y_p^2 - 2y_p f(x) + f(x)^2$.
+$d_{P,f}^2 = (x_p^2 - 2x_p x + x^2) + (y_p^2 - 2y_p f(x) + f(x)^2)$.
 
-In order to solve the minimal distance problem, Fermat's theorem
+In order to solve the minimal distance problem, Fermat's theorem 
 about stationary points will be tremendously usefull:
 
 \begin{theorem}[Fermat's theorem about stationary points]\label{thm:fermats-theorem}
@@ -20,10 +20,15 @@ about stationary points will be tremendously usefull:
     Then: $f'(x_0) = 0$.
 \end{theorem}
 
-So in fact you can calculate the roots of $(d_{P,f}(x))'$ to get
-candidates for minimal distance. These candidates include all points
-with minimal distance, but might also contain more. Example~\ref{ex:false-positive}
-shows such a situation.
+So in fact you can calculate the roots of $(d_{P,f}(x))'$ or $(d_{P,f}(x)^2)'$ to get
+candidates for minimal distance.
+$(d_{P,f}(x)^2)'$ is a polynomial if $f$ is a polynomial. So if $f$ 
+is a polynomial, we can always get a finite number of candidates by 
+finding roots of $(d_{P,f}(x)^2)'$. But this gets difficult when $f$
+has degree 3 or higher as explained in Theorem~\ref{thm:no-finite-solution}.
+Another problem one has to bear in mind is that these candidates 
+include all points with minimal distance, but might also contain 
+more. Example~\ref{ex:false-positive} shows such a situation.
 
 Let $S_n$ be the function that returns the set of solutions for a
 polynomial $f$ of degree $n$ and a point $P$:

+ 11 - 16
documents/math-minimal-distance-to-cubic-function/quadratic-case-2.1.tex

@@ -1,10 +1,8 @@
 $4 \alpha^3 + 27 \beta^2 \geq 0$:
-One solution of Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
-is
+The first solution of $x^3 + \alpha x + \beta = 0$ is
 \[x = \frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}\]
 
-When you insert this in Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
-you get:\footnote{Remember: $(a-b)^3 = a^3-3 a^2 b+3 a b^2-b^3$}
+Let's validate this solution:
 \allowdisplaybreaks
 \begin{align}
     0 &\stackrel{!}{=} \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right )^3 + \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
@@ -12,27 +10,24 @@ you get:\footnote{Remember: $(a-b)^3 = a^3-3 a^2 b+3 a b^2-b^3$}
     - 3 (\frac{t}{\sqrt[3]{18}})^2 \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} 
     + 3 (\frac{t}{\sqrt[3]{18}})(\frac{\sqrt[3]{\frac{2}{3}} \alpha }{t})^2 
     - (\frac{\sqrt[3]{\frac{2}{3}} \alpha }{t})^3 
-    + \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
+    + \frac{t \alpha}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha^2 }{t} + \beta\\
 &= \frac{t^3}{18}             
     - \frac{3t^2}{\sqrt[3]{18^2}} \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}
     + \frac{3t}{\sqrt[3]{18}} \frac{\sqrt[3]{\frac{4}{9}} \alpha^2 }{t^2} 
     - \frac{\frac{2}{3} \alpha^3 }{t^3} 
-    + \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
+    + \frac{t \alpha }{\sqrt[3]{18}} - \frac{\sqrt[3]{2} \alpha^2 }{\sqrt[3]{3} t} + \beta\\
 &= \frac{t^3}{18}
     - \frac{\sqrt[3]{18} t \alpha}{\sqrt[3]{18^2}}
     + \frac{\sqrt[3]{12} \alpha^2}{\sqrt[3]{18} t}  
     - \frac{2 \alpha^3 }{3t^3} 
-    + \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
+    + \frac{t \alpha }{\sqrt[3]{18}} - \frac{\sqrt[3]{2} \alpha^2 }{\sqrt[3]{3} t} + \beta\\
 &= \frac{t^3}{18} 
-    - \frac{t \alpha}{\sqrt[3]{18}} 
-    \color{red}+ \frac{\sqrt[3]{2} \alpha^2}{\sqrt[3]{3} t} \color{black}
-    - \frac{2 \alpha^3 }{3 t^3} 
-    + \color{red}\alpha \color{black} \left (\frac{t}{\sqrt[3]{18}}  \color{red}- \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \color{black}\right ) 
-    + \beta\\
-&= \frac{t^3}{18} \color{blue}- \frac{t \alpha}{\sqrt[3]{18}} \color{black} 
-    - \frac{2 \alpha^3 }{3 t^3} 
-    \color{blue}+ \frac{\alpha t}{\sqrt[3]{18}} \color{black} 
-    + \beta\\
+    \color{blue} - \frac{t \alpha}{\sqrt[3]{18}}
+    \color{red}  + \frac{\sqrt[3]{2} \alpha^2}{\sqrt[3]{3} t}
+    \color{black}- \frac{2 \alpha^3 }{3 t^3} 
+    \color{blue} + \frac{t \alpha }{\sqrt[3]{18}} 
+    \color{red}  - \frac{\sqrt[3]{2} \alpha^2 }{\sqrt[3]{3} t} 
+    \color{black}+ \beta\\
 &= \frac{t^3}{18} - \frac{2 \alpha^3 }{3 t^3} + \beta\\
 &= \frac{t^6 - 12 \alpha^3 + \beta 18 t^3}{18t^3}
 \end{align}

+ 5 - 3
documents/math-minimal-distance-to-cubic-function/quadratic-case-2.2.tex

@@ -1,8 +1,8 @@
-One solution is
+The second solution of $x^3+\alpha x + \beta=0$ is
 \[x = \frac{(1+i \sqrt{3})\alpha}{\sqrt[3]{12} \cdot t}
      -\frac{(1-i\sqrt{3}) t}{2\sqrt[3]{18}}\]
 
-We will verify it in multiple steps. First, get $x^3$:
+We will verify it in multiple steps. First, calculate $x^3$:
 \begin{align}
     x^3 &= \underbrace{\left (\frac{(1+i\sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \right)^3}_{=: \raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {1}}}}
            \underbrace{- 3 \left(\frac{(1+i\sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \right)^2 \left(\frac{(1-i\sqrt{3})t}{2 \sqrt[3]{18}} \right)}_{=: \raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {2}}}}\\
@@ -58,5 +58,7 @@ Now continue with only the numerator
         \color{orange}- 2 \cdot \sqrt{3(4 \alpha^3 + 27 \beta^2)} \cdot 9\beta\color{black}
         + \color{blue}81 \beta^2\color{black}
     \right )\\
-    &\hphantom{{}=}+ 18 \beta (\color{orange}\sqrt{3(4 \alpha^3 + 27 \beta^2)}\color{black} \color{blue}- 9 \beta\color{black}) 
+    &\hphantom{{}=}+ 18 \beta (\color{orange}\sqrt{3(4 \alpha^3 + 27 \beta^2)}\color{black} \color{blue}- 9 \beta\color{black}) \\
+    &= 81 \beta^2 + 81 \beta^2 - 2 \cdot 81 \beta^2\\
+    &= 0
 \end{align}

+ 1 - 1
documents/math-minimal-distance-to-cubic-function/quadratic-case-2.3.tex

@@ -1,4 +1,4 @@
-One solution is
+The third and thus last solution of $x^3 + \alpha x + \beta = 0$ is
 \[x = \frac{(1-i \sqrt{3}) \alpha}{\sqrt[3]{12} \cdot t}
      -\frac{(1+i\sqrt{3}) t}{2\sqrt[3]{18}}\]
 

+ 16 - 15
documents/math-minimal-distance-to-cubic-function/quadratic-functions.tex

@@ -1,6 +1,6 @@
 \chapter{Quadratic functions}
 \section{Defined on $\mdr$}
-Let $f(x) = a \cdot x^2 + b \cdot x + c$ with $a \in \mdr \setminus \Set{0}$ and 
+Let $f:\mdr \rightarrow \mdr, f(x) = a \cdot x^2 + b \cdot x + c$ with $a \in \mdr \setminus \Set{0}$ and 
 $b, c \in \mdr$ be a quadratic function.
 
 \begin{figure}[htp]
@@ -41,7 +41,7 @@ $b, c \in \mdr$ be a quadratic function.
 \end{figure}
 
 \subsection{Calculate points with minimal distance}
-In this case, $d_{P,f}^2$ is polynomial of degree 4. 
+In this case, $d_{P,f}^2$ is polynomial of degree $n^2 = 4$. 
 We use Theorem~\ref{thm:fermats-theorem}:\nobreak
 \begin{align}
     0     &\overset{!}{=} (d_{P,f}^2)'\\
@@ -58,10 +58,11 @@ This is an algebraic equation of degree 3.
 There can be up to 3 solutions in such an equation. Those solutions
 can be found with a closed formula. But not every solution of the
 equation given by Theorem~\ref{thm:fermats-theorem}
-has to be a solution to the given problem.
+has to be a solution to the given problem as you can see in
+Example~\ref{ex:false-positive}.
 \goodbreak
 \begin{example}\label{ex:false-positive}
-    Let $a = 1,  b = 0,  c= 1, x_p= 0, y_p = 1$.
+    Let $a = 1,  b = 0,  c=-1, x_p= 0, y_p = 1$.
     So $f(x) = x^2 - 1$ and $P(0, 1)$.
     \begin{align}
         \xRightarrow{\text{Equation}~\ref{eq:quadratic-derivative-eq-0}} 0 &\stackrel{!}{=} 2x^3 - 3x\\
@@ -86,12 +87,13 @@ has to be a solution to the given problem.
 \begin{proof}
 The number of closests points of $f$ cannot be bigger than 3, because
 Equation~\ref{eq:quadratic-derivative-eq-0} is a polynomial function
-of degree 3. Such a function can have at most 3 roots.
+of degree 3. Such a function can have at most 3 roots. As $f$ has
+at least one point on its graph, there is at least one point with
+minimal distance.
 
 In the following, I will do some transformations with $f = f_0$ and
-$P = P_0$.
-
-Moving $f_0$ and $P_0$ simultaneously in $x$ or $y$ direction does 
+$P = P_0$. This will make it easier to calculate the minimal distance
+points. Moving $f_0$ and $P_0$ simultaneously in $x$ or $y$ direction does 
 not change the minimum distance. Furthermore, we can find the 
 points with minimum distance on the moved situation and calculate
 the minimum points in the original situation.
@@ -128,9 +130,9 @@ Then compute:
     &= \sqrt{\left (a x^2 + \nicefrac{1}{2a}- w \right )^2 + \left (w^2 - \left (\frac{1-2 a w}{2a} \right )^2 \right)}
 \end{align}
 
-The term 
+This means, the term
 \[a^2 x^2 + (\nicefrac{1}{2a}- w)\]
-should get as close to $0$ as possilbe when we want to minimize 
+has to get as close to $0$ as possilbe when we want to minimize 
 $d_{P,{f_2}}$. For $w \leq \nicefrac{1}{2a}$ you only have $x = 0$ as a minimum.
 For all other points $P = (0, w)$, there are exactly two minima $x_{1,2} = \pm \sqrt{\frac{\frac{1}{2a} - w}{a}}$.
 $\qed$
@@ -153,9 +155,9 @@ Otherwise, there is only one solution $x_1 = 0$.
     &= \sqrt{a^2x^4 + (1- 2 aw)x^2 +(- 2z)x + z^2 + w^2}\\
   0 &\stackrel{!}{=} \Big(\big(d_{P, {f_2}}(x)\big)^2\Big)' \\
     &= 4a^2x^3 + 2(1- 2 aw)x +(- 2z)\\
-    &= 2 \left (2a^2x^2 + (1- 2 aw) \right )x - 2z\\
+    &= 2 \left (2a^2x^3 + (1- 2 aw)x \right ) - 2z\\
     \Leftrightarrow 0 &\stackrel{!}{=} 2a^2x^3  + (1- 2 aw) x - z\\
-\Leftrightarrow 0 &\stackrel{!}{=} x^3 + \underbrace{\frac{1- 2 aw}{2 a^2}}_{=: \alpha} x  + \underbrace{\frac{-z}{2 a^2}}_{=: \beta}\\
+\stackrel{a \neq 0}{\Leftrightarrow} 0 &\stackrel{!}{=} x^3 + \underbrace{\frac{1- 2 aw}{2 a^2}}_{=: \alpha} x  + \underbrace{\frac{-z}{2 a^2}}_{=: \beta}\\
     &= x^3 + \alpha x + \beta\label{eq:simple-cubic-equation-for-quadratic-distance}
 \end{align}
 
@@ -166,7 +168,8 @@ I will make use of the following identities:
 \begin{align*}
     (1-i \sqrt{3})^2     &= -2 (1+i \sqrt{3})\\
     (1+i \sqrt{3})^2     &= -2 (1-i \sqrt{3})\\
-    (1 \pm i \sqrt{3})^3 &= -8
+    (1 \pm i \sqrt{3})^3 &= -8\\
+    (a-b)^3              &= a^3-3 a^2 b+3 a b^2-b^3
 \end{align*}
 
 \textbf{Case 2.1:} 
@@ -194,8 +197,6 @@ t &:= \sqrt[3]{\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta}\\
      x_1 = \frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}   &\text{if } x_P \neq x_S
     \end{cases}
 \end{align*}
-
-I call this function $S_2: \Set{\text{Quadratic functions}} \times \mdr^2 \rightarrow \mathcal{P}({\mdr})$.  
 \clearpage
 
 \section{Defined on a closed interval $[a,b] \subseteq \mdr$}