Christoffel Graph

Christoffel graph

This module was developped for the article on a d-dimensional extension of Christoffel Words written with Christophe Reutenauer [LR2014].

[LR2014]Labbé, Sébastien, and Christophe Reutenauer. A d-dimensional Extension of Christoffel Words. arXiv:1404.4021 (April 15, 2014).

EXAMPLES:

Christoffel graph in 2d (tikz code):

sage: from slabbe import ChristoffelGraph, DiscreteBox
sage: C = ChristoffelGraph((2,5))
sage: b = DiscreteBox([-5,5],[-5,5])
sage: I = C & b
sage: point_kwds = {'label':lambda p:C.level_value(p),'label_pos':'above right'}
sage: tikz = I.tikz_noprojection(scale=0.8,point_kwds=point_kwds)

Christoffel graph in 3d (tikz code):

sage: C = ChristoffelGraph((2,3,5))
sage: tikz = C.tikz_kernel()

TODO:

  • Clean kernel_vector method of ChristoffelGraph
class slabbe.christoffel_graph.ChristoffelGraph(v, mod=None)

Bases: slabbe.discrete_subset.DiscreteSubset

Subset of a discrete object such that its projection by a matrix is inside a certain box.

INPUT:

  • v - vector, normal vector

EXAMPLES:

sage: from slabbe import ChristoffelGraph
sage: ChristoffelGraph((2,5))
Christoffel set of edges for normal vector v=(2, 5)
sage: C = ChristoffelGraph((2,5))
sage: it = C.edges_iterator()
sage: it.next()
((0, 0), (1, 0))
sage: C = ChristoffelGraph((2,5,8))
sage: it = C.edges_iterator()
sage: it.next()
((0, 0, 0), (1, 0, 0))
sage: from slabbe import DiscreteBox
sage: C = ChristoffelGraph((2,5))
sage: b = DiscreteBox([-5,5],[-5,5])
sage: I = C & b
sage: point_kwds = {'label':lambda p:C.level_value(p),'label_pos':'above right'}
sage: tikz = I.tikz_noprojection(scale=0.8,point_kwds=point_kwds)

TEST:

This was once a bug. We make sure it is fixed:

sage: from slabbe import DiscreteSubset
sage: C = ChristoffelGraph((2,3,5))
sage: isinstance(C, DiscreteSubset)
True
has_edge(p, s)

Returns whether it has the edge (p, s) where s-p is a canonical vector.

INPUT:

  • p - point in the space
  • s - point in the space

EXAMPLES:

sage: from slabbe import ChristoffelGraph
sage: C = ChristoffelGraph((2,5,8))
sage: C.has_edge(vector((0,0,0)), vector((0,0,1)))
True
sage: C.has_edge(vector((0,0,0)), vector((0,0,2)))
False
sage: C.has_edge(vector((0,0,0)), vector((0,0,-1)))
False
sage: C = ChristoffelGraph((2,5))
sage: C.has_edge(vector((0,0)),vector((1,0)))
True
sage: C.has_edge(vector((0,0)),vector((-1,0)))
False
sage: C.has_edge(vector((-1,1)),vector((1,0)))
False
kernel_vector(way='LLL', verbose=False)

todo: clean this

EXAMPLES:

sage: from slabbe import ChristoffelGraph
sage: C = ChristoffelGraph((2,5,7))
sage: C.kernel_vector()
[(-1, -1, 1), (3, -4, 0)]
level_value(p)

Return the level value of a point p.

INPUT:

  • p - point in the space

EXAMPLES:

sage: from slabbe import ChristoffelGraph
sage: C = ChristoffelGraph((2,5,8))
sage: C.level_value(vector((2,3,4)))
6
sage: C.level_value(vector((1,1,1)))
0
tikz_kernel(projmat=[-0.866025403784439 0.866025403784439 0.000000000000000] [-0.500000000000000 -0.500000000000000 1.00000000000000], scale=1, edges=True, points=True, label=False, point_kwds={}, edge_kwds={}, extra_code='', way='LLL', kernel_vector=None)

INPUT:

  • projmat – (default: M3to2) 2 x dim projection matrix where dim is the dimensoin of self, the isometric projection is used by default
  • scale – real number (default: 1), scaling constant for the whole figure
  • edges - bool (optional, default: True), whether to draw edges
  • points - bool (optional, default: True), whether to draw points
  • point_kwds - dict (default: {})
  • edge_kwds - dict (default: {})
  • extra_code – string (default: ''), extra tikz code to add
  • way – string (default: 'LLL'), the way the base of the kernel is computed
  • kernel_vector – list (default: None), the vectors, if None it uses kernel_vector() output.

EXAMPLES:

sage: from slabbe import ChristoffelGraph
sage: C = ChristoffelGraph((2,3,5))
sage: tikz = C.tikz_kernel()
sage: tikz
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
[scale=1]
\clip (-5.239453693, 2.025) -- (-5.239453693, -1.025) -- (-4.330127019, -1.55) -- (0.0, -1.05) -- (0.909326674, -0.525) -- (0.909326674, 2.525) -- (0.0, 3.05) -- (-4.330127019, 2.55) -- cycle;
 \draw[very thick, blue] (0.00000, 0.00000) -- (-0.86603, -0.50000);
\draw[very thick, blue] (0.00000, 0.00000) -- (0.86603, -0.50000);
...
... 296 lines not printed (24077 characters in total) ...
...
\node[circle,fill=black,draw=black,minimum size=0.8mm,inner sep=0pt,] at (-6.92820, -3.00000) {};
 \filldraw[fill=white,very thick,dotted,opacity=0.5,even odd rule]
  (-5.239453693, 2.025) -- (-5.239453693, -1.025) -- (-4.330127019, -1.55) -- (0.0, -1.05) -- (0.909326674, -0.525) -- (0.909326674, 2.525) -- (0.0, 3.05) -- (-4.330127019, 2.55) -- cycle
  (-4.330127019, 1.5) -- (-4.330127019, -0.5) -- (0.0, 0.0) -- (0.0, 2.0) -- cycle;
 \end{tikzpicture}
\end{document}