diff --git a/documents/math-minimal-distance-to-cubic-function/constant-functions.tex b/documents/math-minimal-distance-to-cubic-function/constant-functions.tex index 37746c0..9e26861 100644 --- a/documents/math-minimal-distance-to-cubic-function/constant-functions.tex +++ b/documents/math-minimal-distance-to-cubic-function/constant-functions.tex @@ -116,3 +116,11 @@ The point with minimum distance can be found by: \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}\] + +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} diff --git a/documents/math-minimal-distance-to-cubic-function/cubic-functions.tex b/documents/math-minimal-distance-to-cubic-function/cubic-functions.tex index 8656b8f..f23a781 100644 --- a/documents/math-minimal-distance-to-cubic-function/cubic-functions.tex +++ b/documents/math-minimal-distance-to-cubic-function/cubic-functions.tex @@ -216,4 +216,4 @@ initial guess. \todo[inline]{TODO} \clearpage -\section{Defined on a closed interval of $\mdr$} +\section{Defined on a closed interval $[a,b] \subseteq \mdr$} diff --git a/documents/math-minimal-distance-to-cubic-function/linear-functions.tex b/documents/math-minimal-distance-to-cubic-function/linear-functions.tex index 5485b74..0f14f36 100644 --- a/documents/math-minimal-distance-to-cubic-function/linear-functions.tex +++ b/documents/math-minimal-distance-to-cubic-function/linear-functions.tex @@ -29,6 +29,8 @@ $t \in \mdr$ be a linear function. \addplot[domain=-5:5, thick,samples=50, red] {0.5*x}; \addplot[domain=-5:5, thick,samples=50, blue] {-2*x+6}; \addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 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$} \addlegendentry{$f_\bot(x)=-2x+6$} \end{axis} @@ -115,10 +117,4 @@ The point with minimum distance can be found by: \Set{b} &\text{if } S_1(f, P) \ni x > b \end{cases}\] -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} +\todo[inline]{argument? proof?} diff --git a/documents/math-minimal-distance-to-cubic-function/math-minimal-distance-to-cubic-function.pdf b/documents/math-minimal-distance-to-cubic-function/math-minimal-distance-to-cubic-function.pdf index 0df469e..0c8d8f7 100644 Binary files a/documents/math-minimal-distance-to-cubic-function/math-minimal-distance-to-cubic-function.pdf and b/documents/math-minimal-distance-to-cubic-function/math-minimal-distance-to-cubic-function.pdf differ diff --git a/documents/math-minimal-distance-to-cubic-function/quadratic-functions.tex b/documents/math-minimal-distance-to-cubic-function/quadratic-functions.tex index 304dab7..6d11b76 100644 --- a/documents/math-minimal-distance-to-cubic-function/quadratic-functions.tex +++ b/documents/math-minimal-distance-to-cubic-function/quadratic-functions.tex @@ -80,6 +80,7 @@ As you can easily verify, only $x_1$ is a minimum of $d_{P,f}$. quadratic function $f$ that are closest to $P$. \end{theorem} +\begin{proof} In the following, I will do some transformations with $f = f_0$ and $P = P_0$ . @@ -107,7 +108,7 @@ to add $+1$.} Then move $f_1$ and $P_1$ by $\frac{b^2}{4a}-c$ in $y$ direction. You get: \[f_2(x) = ax^2\;\;\;\text{ and }\;\;\; P_2 = \Big (\underbrace{x_P+\frac{b}{2a}}_{=: z},\;\; \underbrace{y_P+\frac{b^2}{4a}-c}_{=: w} \Big )\] -\textbf{Case 1:} As $f_2(x) = ax^2$ is symmetric to the $y$ axis, only points +As $f_2(x) = ax^2$ is symmetric to the $y$ axis, only points $P = (0, w)$ could possilby have three minima. Then compute: @@ -125,6 +126,18 @@ The term should 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{aw - \nicefrac{1}{2}}$. +$\qed$ +\end{proof} + +\subsection{Solution formula} +We start with the graph that was moved so that $f_2 = ax^2$. + +\textbf{Case 1:} $P$ is on the symmetry axis, hence $x_P = - \frac{b}{2a}$. + +In this case, we have already found the solution. If $y_P + \frac{b^2}{4a} - c > \frac{1}{2a}$, +then there are two solutions: +\[x_{1,2} = \pm \sqrt{aw - \nicefrac{1}{2}}\] +Otherwise, there is only one solution $x_1 = 0$. \textbf{Case 2:} $P = (z, w)$ is not on the symmetry axis, so $z \neq 0$. Then you compute: \begin{align} @@ -140,10 +153,12 @@ For all other points $P = (0, w)$, there are exactly two minima $x_{1,2} = \pm \ &= x^3 + \alpha x + \beta\label{eq:simple-cubic-equation-for-quadratic-distance} \end{align} +Let $t$ be defined as +\[t := \sqrt[3]{\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta}\] + +\textbf{Case 2.1:} $4 \alpha^3 + 27 \beta^2 \geq 0$: The solution of Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance} is -\todo[inline]{Can $4 \alpha^3 + 27 \beta^2$ be negative for $\alpha=\frac{1-2aw}{2a^2}$ and $\beta = \frac{-z}{2a^2}$?} -\[t := \sqrt[3]{\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta}\] \[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} @@ -190,6 +205,16 @@ $t$: &= 0 \end{align} +\textbf{Case 2.2:} TODO + +\[x = \frac{(1+i \sqrt{3})a}{\sqrt[3]{12} \cdot t} + -\frac{(1-i\sqrt{3}) t}{2\sqrt[3]{18}}\] + +\textbf{Case 2.3:} TODO + +\[x = \frac{(1-i \sqrt{3})a}{\sqrt[3]{12} \cdot t} + -\frac{(1+i\sqrt{3}) t}{2\sqrt[3]{18}}\] + \goodbreak So the solution is given by \todo[inline]{NO! Currently, there are erros in the solution.