# Knight's metric: ellipse and parabola.

Knight's metric is a metric on $\mathbb{Z}^2$ as the minimum number of moves a chess knight would take to travel from $x$ to $y\in\mathbb{Z}^2$. What does a parabola (or an ellipse) became with this new metric? I apologize if the question is too vague.

• You'd first have to explain what precisely you mean by "parabola" or "ellipse".
– user14972
Mar 25, 2014 at 13:26
• An ellipse is a curve that is the locus of all points in the plane such that the sum of whose distances from two fixed points F_1 and F_2 (the foci) is a given positive constant. Mar 25, 2014 at 13:32
• I mean knight's distance. Mar 25, 2014 at 13:32
• Parabola may be problematic. What is a straight line in this case? First of all, it depends on the angle, and secondly, the traditional "line" is no longer the path of shortest distance. Mar 25, 2014 at 14:05
• You could have meant to use the parabolas from standard geometry too, rather than choosing the specific definition you gave. And besides, lines are sometimes defined by sets such that two of $d(a,b)$, $d(b,c)$ and $d(a,c)$ sum to the third for any three $a,b,c$ in the line. But the real question of just what you mean by line is the fact your space is $\mathbb{Z}^2$ rather than $\mathbb{R}^2$.
– user14972
Mar 25, 2014 at 14:16

Using Noam D. Elkies's characterization of the knight's distance, here's an animation of $d(x,y)+d(x-a,y)$ as $a$ goes from $0$ to $30$. All cells of the same colour are on the same "ellipse" (except the darkest red ones, which have distance $\ge20$).

• I have been amazed at your animation. Can you say how you have realized your animation, and, as important haow you have included it ? Is it animated gif format ? Dec 8, 2017 at 21:10
• @JeanMarie Yes, I computed a sequence of plots in Mathematica and exported the sequence as a single animated GIF.
– user856
Dec 8, 2017 at 21:20

huge comment/hint:

$\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline 0&5&4&5&4&5&4&5&4&5&4&5&4&5&0\\ \hline 5&4&5&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&5&4&5\\ \hline 4&5&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&5&4\\ \hline 5&4&\color{orange}3&4&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&4&\color{orange}3&4&5\\ \hline 4&\color{orange}3&4&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&4&\color{orange}3&4\\ \hline 5&4&\color{orange}3&\color{blue}2&\color{orange}3&4&\color{red}1&\color{blue}2&\color{red}1&4&\color{orange}3&\color{blue}2&\color{orange}3&4&5\\ \hline 4&\color{orange}3&4&\color{orange}3&\color{blue}2&\color{red}1&\color{blue}2&\color{orange}3&\color{blue}2&\color{red}1&\color{blue}2&\color{orange}3&4&\color{orange}3&4\\ \hline 5&4&\color{orange}3&2&\color{orange}3&\color{blue}2&\color{orange}3&0&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&4&5\\ \hline 4&\color{orange}3&4&\color{orange}3&\color{blue}2&\color{red}1&\color{blue}2&\color{orange}3&\color{blue}2&\color{red}1&\color{blue}2&\color{orange}3&4&\color{orange}3&4\\ \hline 5&4&\color{orange}3&\color{blue}2&\color{orange}3&4&\color{red}1&\color{blue}2&\color{red}1&4&\color{orange}3&2&\color{orange}3&4&5\\ \hline 4&\color{orange}3&4&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&4&\color{orange}3&4\\ \hline 5&4&\color{orange}3&4&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&\color{blue}2&\color{orange}3&4&\color{orange}3&4&5\\ \hline 4&5&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&5&4\\ \hline 5&4&5&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&\color{orange}3&4&5&4&5\\ \hline 0&5&4&5&4&5&4&5&4&5&4&5&4&5&0\\ \hline \end{array}$

is the closest I could get it to work in PARI/GP right now for labeling it's too large an example for a true comment sadly. mods can size it down if they want/need.

• This just shows the "Knight's distance" of each square from the center square, right? So it doesn't actually say anything about ellipses and parabolas, right? And why are there zeros in the corners? Jun 30, 2017 at 9:22
• Because, I didn't let PARI/GP run long enough, it was late at night. My point, was about the circles comment. because this shows that there are different groupings of the threes 3. Also it would take coloring etc to show an ellipse as defined ( As well as, a second stationary point).
– user451844
Jun 30, 2017 at 10:28
• knight(n)=my(a=matrix(n,n),b=[[n\2,n\2]]);for(y=1,10,b=apply(r->[[r[1]+2,r[2]+1],[r[1]+2,r[2]-1],[r[1]-2,r[2]+1],[r[1]-2,r[2]-1],[r[1]-1,r[2]-2],[r[1]-1,r[2]+2],[r[1]+1,r[2]+2],[r[1]+1,r[2]-2]],b);b=select(r->r!=[n\2,n\2]&&r[1]>-2&&r[1]<n+2&&r[2]>-2&&r[2]<n+2,fold((x,y)->concat(x,y),b));for(x=1,#b,if(b[x][1]<n+1&&b[x][1]>0&&b[x][2]<n+1&&b[x][2]>0&&a[b[x][1],b[x][2]]==0,a[b[x][1],b[x][2]]=y));for(z=1,#a,print(a[z,]));print()) is the code if anyone wants to use it.
– user451844
Jun 30, 2017 at 10:32
• realized it was so slow because I wasn't deleting duplicates. vecsort(,,8) around the fold was all it took to speed it up, that and now I should use an until loop not a for loop.
– user451844
Jun 30, 2017 at 11:27