In [13]:
# load the package badic (you can install it with "sage -pip install badic [--user]")
from badic import *
In [14]:
# we define a simple automaton
a = DetAutomaton([(0,1,0),(0,2,2),(1,1,0),(1,1,1),(1,1,2), (2,2,0),(2,2,2)], i=0)
a.plot()
Out[14]:
In [11]:
# we take a beta-adic set with this automaton, for beta = 1/(1+sqrt(2))
# we see that it is a intervalle union a Cantor set
m = BetaAdicSet(1/(1+sqrt(2)), a)
print(m)
m.plot()
b-adic set with b root of x^2 + 2*x - 1, and an automaton of 3 states and 3 letters
Out[11]:
In [7]:
# compute a substitution from it
d = m.substitution()
d
Out[7]:
{1: [5],
 2: [3, 1, 4],
 3: [3, 1, 7],
 4: [9, 2],
 5: [3, 1],
 6: [6, 6, 8],
 7: [9, 2, 6, 8],
 8: [6],
 9: [7]}
In [9]:
# check that the Rauzy fractal is the one expected
s = WordMorphism(d)
print(s)
s.rauzy_fractal_plot()
1->5, 2->314, 3->317, 4->92, 5->31, 6->668, 7->9268, 8->6, 9->7
Out[9]:
In [ ]: