mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
minor changes
This commit is contained in:
parent
a1274e176f
commit
03d2d98754
7 changed files with 36 additions and 47 deletions
|
@ -3,7 +3,7 @@ When you want to develop a selfdriving car, you have to plan which path
|
|||
it should take. A reasonable choice for the representation of
|
||||
paths are cubic splines. You also have to be able to calculate
|
||||
how to steer to get or to remain on a path. A way to do this
|
||||
is applying the \href{https://en.wikipedia.org/wiki/PID_algorithm}{PID algorithm}.
|
||||
is by applying the \href{https://en.wikipedia.org/wiki/PID_algorithm}{PID algorithm}.
|
||||
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)
|
||||
|
@ -13,7 +13,7 @@ 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.
|
||||
|
||||
In this paper I want to discuss how to find all points on a cubic
|
||||
In this paper, I want to discuss how to find all points on a cubic
|
||||
function with minimal distance to a given point.
|
||||
As other representations of paths might be easier to understand and
|
||||
to implement, I will also cover the problem of finding the minimal
|
||||
|
@ -21,7 +21,7 @@ distance of a point to a polynomial of degree 0, 1 and 2.
|
|||
|
||||
While I analyzed this problem, I've got interested in variations
|
||||
of the underlying PID-related problem. So I will try to give
|
||||
robust and easy-to-implement algorithms to calculated the distance
|
||||
robust and easy-to-implement algorithms to calculate the distance
|
||||
of a point to a (piecewise or global) defined polynomial function
|
||||
of degree $\leq 3$.
|
||||
|
||||
|
|
|
@ -46,30 +46,18 @@
|
|||
\end{figure}
|
||||
|
||||
\begin{proof}
|
||||
Now you can drop a perpendicular $f_\bot$ through $P$ on $f(x)$. The
|
||||
slope of $f_\bot$ is $- \frac{1}{m}$ and $t_\bot$ can be calculated:\nobreak
|
||||
With Theorem~\ref{thm:fermats-theorem} you get:
|
||||
\begin{align}
|
||||
f_\bot(x) &= - \frac{1}{m} \cdot x + t_\bot\\
|
||||
\Rightarrow y_P &= - \frac{1}{m} \cdot x_P + t_\bot\\
|
||||
\Leftrightarrow t_\bot &= y_P + \frac{1}{m} \cdot x_P
|
||||
0 &\stackrel{!}{=} (d_{P,f}(x)^2)'\\
|
||||
&= 2(x-x_P) + 2 (f(x) - y_P)f'(x)\\
|
||||
\Leftrightarrow 0 &\stackrel{!}{=} x - x_P + (f(x) - y_P) f'(x)\\
|
||||
&= x- x_P + (mx+t - y_P)\cdot m\\
|
||||
&= x (m+1) + m(t-y_P) - x_P\\
|
||||
\Leftrightarrow x &\stackrel{!}{=} \frac{x_p - m(t-y_p)}{m^2+1}\\
|
||||
&= \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\label{eq:solution-linear-r}
|
||||
\end{align}
|
||||
|
||||
The point $(x, f(x))$ where the perpendicular $f_\bot$ crosses $f$
|
||||
is calculated this way:
|
||||
\begin{align}
|
||||
f(x) &= f_\bot(x)\\
|
||||
\Leftrightarrow m \cdot x + t &= - \frac{1}{m} \cdot x + \left(y_P + \frac{1}{m} \cdot x_P \right)\\
|
||||
\Leftrightarrow \left (m + \frac{1}{m} \right ) \cdot x &= y_P + \frac{1}{m} \cdot x_P - t\\
|
||||
\Leftrightarrow x &= \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\label{eq:solution-of-the-linear-problem}
|
||||
\end{align}
|
||||
|
||||
There is only one point with minimal distance. I'll call the result
|
||||
from line~\ref{eq:solution-of-the-linear-problem} \enquote{solution of
|
||||
the linear problem} and the function that gives this solution
|
||||
$S_1(f,P)$.
|
||||
|
||||
See Figure~\ref{fig:linear-min-distance}
|
||||
to get intuition about the geometry used. $\qed$
|
||||
It is obvious that a minium has to exist, the $x$ from Equation~\ref{eq:solution-linear-r}
|
||||
has to be this minimum.
|
||||
\end{proof}
|
||||
\clearpage
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
\chapter{Description of the Problem}
|
||||
Let $f: D \rightarrow \mdr$ with $D \subseteq \mdr$ be a polynomial function and $P \in \mdr^2$
|
||||
be a point. Let $d_{P,f}: \mdr \rightarrow \mdr_0^+$
|
||||
be the Euklidean distance of a point $P$ to a point $\left (x, f(x) \right )$
|
||||
be the Euklidean distance of $P$ to a point $\left (x, f(x) \right )$
|
||||
on the graph of $f$:
|
||||
\[d_{P,f} (x) := \sqrt{(x - x_P)^2 + (f(x) - y_P)^2}\]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
$4 \alpha^3 + 27 \beta^2 \geq 0$:
|
||||
The solution of Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
|
||||
One solution of Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
|
||||
is
|
||||
\[x = \frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}\]
|
||||
|
||||
|
|
|
@ -1,26 +1,28 @@
|
|||
\todo[inline]{calculate...}
|
||||
|
||||
One solution 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$:
|
||||
\begin{align}
|
||||
x^3 &= \left (\frac{(1-i \sqrt{3}) \alpha}{\sqrt[3]{12} \cdot t} - \frac{(1+i\sqrt{3}) t}{2\sqrt[3]{18}} \right)^3\\
|
||||
&= \left (\frac{(2\sqrt[3]{18})(1-i \sqrt{3}) \alpha - (\sqrt[3]{12} \cdot t)(1+i\sqrt{3}) t}{\sqrt[3]{12} \cdot t \cdot 2 \cdot \sqrt[3]{18}} \right)^3\\
|
||||
&= \left (\frac{2\sqrt[3]{18}a \alpha (1-i \sqrt{3}) - \sqrt[3]{12} \cdot t^2(1+i\sqrt{3})}{2t \sqrt[3]{2^3 \cdot 3^3}} \right )^3\\
|
||||
&= 12 \cdot \bigg (\frac{\overbrace{\sqrt[3]{12} \alpha (1-i \sqrt{3}) - t^2(1+i\sqrt{3})}^{\text{numerator}}}{12t} \bigg )^3
|
||||
&= \left (\frac{(2\sqrt[3]{18})(1-i \sqrt{3}) \alpha - (\sqrt[3]{12} \cdot t)(1+i\sqrt{3}) t}{\sqrt[3]{12} t \cdot 2 \sqrt[3]{18}} \right)^3\\
|
||||
&= \left (\frac{2\sqrt[3]{18}\alpha (1-i \sqrt{3}) - \sqrt[3]{12} t^2(1+i\sqrt{3})}{2t \cdot 6} \right )^3\\
|
||||
&= \bigg (\frac{\overbrace{\sqrt[3]{12} \alpha (1-i \sqrt{3}) - t^2 (1+i\sqrt{3})}^{\text{numerator}}}{\sqrt[3]{12^2} t} \bigg )^3
|
||||
\end{align}
|
||||
|
||||
Now calculate the numerator$^3$:
|
||||
Now calculate numerator$^3$:
|
||||
\begin{align}
|
||||
\left (\sqrt[3]{12} \alpha (1-i \sqrt{3}) - t^2(1+i\sqrt{3}) \right )^3 &=
|
||||
12 \alpha^3 (1-i\sqrt{3})^3 \\
|
||||
&\hphantom{{}=}- 3 \sqrt[3]{12^2} \alpha^2(1-i\sqrt{3})^2 (t^2(1+i \sqrt{3}))\\
|
||||
&\hphantom{{}=}+ 3 \sqrt[3]{12\hphantom{^2}} \alpha\hphantom{^2} (1-i\sqrt{3}) t^4 (1+i\sqrt{3})^2 - t^6 (1+i\sqrt{3})^3\\
|
||||
&= 12 \alpha^3 \cdot (-8) \\
|
||||
&\hphantom{{}=}- 3 \cdot 2 \sqrt[3]{18} \alpha^2(-2(1+i\sqrt{3}))(t^2(1+i \sqrt{3}))\\
|
||||
&\hphantom{{}=}- 3 \sqrt[3]{12^2} \alpha^2(-2(1+i\sqrt{3}))(t^2(1+i \sqrt{3}))\\
|
||||
&\hphantom{{}=}+ 3 \sqrt[3]{12} \alpha (1-i\sqrt{3}) t^4 (-2(1-i\sqrt{3})) - t^6 (-8)\\
|
||||
&= -96 \alpha^3 + 12 \sqrt[3]{18} \alpha^2 t^2 (1+i \sqrt{3})^2\\
|
||||
&\hphantom{{}=}- 6 \sqrt[3]{12} \alpha (1-i\sqrt{3})^2 t^4 +8 t^6\\
|
||||
&= -96 \alpha^3 + 6 \sqrt[3]{12^2} \alpha^2 t^2 (1+i \sqrt{3})^2\\
|
||||
&\hphantom{{}=}- 6 \sqrt[3]{12} \alpha t^4 (1-i\sqrt{3})^2 +8 t^6\\
|
||||
&= -96 \alpha^3 - 12 \sqrt[3]{12^2} \alpha^2 t^2 (1-i \sqrt{3})\\
|
||||
&\hphantom{{}=}+ 12 \sqrt[3]{12} \alpha t^4 (1+i \sqrt{3}) +8 t^6\\
|
||||
&= -96 \alpha^3 - 24 \sqrt[3]{18} \alpha^2 t^2 (1-i \sqrt{3})\\
|
||||
&\hphantom{{}=}+ 12 \sqrt[3]{12} \alpha t^4 (1+i \sqrt{3}) +8 t^6
|
||||
\end{align}
|
||||
|
|
|
@ -45,12 +45,12 @@ In this case, $d_{P,f}^2$ is polynomial of degree 4.
|
|||
We use Theorem~\ref{thm:fermats-theorem}:\nobreak
|
||||
\begin{align}
|
||||
0 &\overset{!}{=} (d_{P,f}^2)'\\
|
||||
&= -2 x_p + 2x -2y_p f'(x) + \left (f(x)^2 \right )'\\
|
||||
&= -2 x_p + 2x -2y_p f'(x) + 2 f(x) \cdot f'(x) \rlap{\hspace*{3em}(chain rule)}\label{eq:minimizingFirstDerivative}\\
|
||||
\Leftrightarrow 0 &\overset{!}{=} -x_p + x -y_p f'(x) + f(x) \cdot f'(x) \rlap{\hspace*{3em}(divide by 2)}\label{eq:minimizingFirstDerivative}\\
|
||||
&= -x_p + x -y_p (2ax+b) + (ax^2+bx+c)(2ax+b)\\
|
||||
&= -x_p + x -y_p \cdot 2ax- y_p b + (2 a^2 x^3+2 a b x^2+2 a c x+ab x^2+b^2 x+bc)\\
|
||||
&= -x_p + x -2y_p ax- y_p b + (2a^2 x^3 + 3 ab x^2 + 2acx + b^2 x + bc)\\
|
||||
&= 2x -2 x_p -2y_p f'(x) + \left (f(x)^2 \right )'\\
|
||||
&= 2x -2 x_p -2y_p f'(x) + 2 f(x) \cdot f'(x) \rlap{\hspace*{3em}(chain rule)}\label{eq:minimizingFirstDerivative}\\
|
||||
\Leftrightarrow 0 &\overset{!}{=} x -x_p -y_p f'(x) + f(x) \cdot f'(x) \rlap{\hspace*{3em}(divide by 2)}\label{eq:minimizingFirstDerivative}\\
|
||||
&= x -x_p -y_p (2ax+b) + (ax^2+bx+c)(2ax+b)\\
|
||||
&= x -x_p -y_p \cdot 2ax- y_p b + (2 a^2 x^3+2 a b x^2+2 a c x+ab x^2+b^2 x+bc)\\
|
||||
&= x -x_p -2y_p ax- y_p b + (2a^2 x^3 + 3 ab x^2 + 2acx + b^2 x + bc)\\
|
||||
&= 2a^2 x^3 + 3 ab x^2 + (1 -2y_p a+ 2ac + b^2)x +(bc-by_p-x_p)\label{eq:quadratic-derivative-eq-0}
|
||||
\end{align}
|
||||
|
||||
|
@ -68,12 +68,11 @@ has to be a solution to the given problem.
|
|||
&= x(2x^2-3)\\
|
||||
\Rightarrow x_{1,2} &= \pm \sqrt{\frac{3}{2}} \text{ and } x_3 = 0\\
|
||||
d_{P,f}(x_3) &= \sqrt{0^2 + (-1-1)^2} = 2\\
|
||||
d_{P,f} \left (+ \sqrt{\frac{3}{2}} \right ) &= \sqrt{\left (\sqrt{\frac{3}{2} - 0} \right )^2 + \left (\frac{1}{2}-1 \right )^2}\\
|
||||
d_{P,f} \left (\pm \sqrt{\frac{3}{2}} \right ) &= \sqrt{\left (\sqrt{\frac{3}{2} - 0} \right )^2 + \left (\frac{1}{2}-1 \right )^2}\\
|
||||
&= \sqrt{\nicefrac{3}{2}+\nicefrac{1}{4}} \\
|
||||
&= \sqrt{\nicefrac{7}{4}}\\
|
||||
&= d_{P,f} \left (- \sqrt{\frac{3}{2}} \right )
|
||||
\end{align}
|
||||
This means $x_3$ is not a point of minimal distance, but with
|
||||
This means $x_3$ is not a point of minimal distance, although
|
||||
$(d_{P,f}(x_3))' = 0$.
|
||||
\end{example}
|
||||
|
||||
|
@ -125,8 +124,8 @@ Then compute:
|
|||
&= \sqrt{x^2 + (ax^2-w)^2}\\
|
||||
&= \sqrt{x^2 + a^2 x^4-2aw x^2+w^2}\\
|
||||
&= \sqrt{a^2 x^4 + (1-2aw) x^2 + w^2}\\
|
||||
&= \sqrt{\left (a x^2 + \frac{1-2 a w}{2a} \right )^2 + w^2 - (\frac{1-2 a w}{2a})^2}\\
|
||||
&= \sqrt{\left (a x^2 + \nicefrac{1}{2a}- w \right )^2 + \big (w^2 - (\frac{1-2 a w}{2a})^2 \big)}
|
||||
&= \sqrt{\left (a x^2 + \frac{1-2 a w}{2a} \right )^2 + w^2 - \left (\frac{1-2 a w}{2a} \right )^2}\\
|
||||
&= \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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue