In [2]:
# load the package badic (you can install it with "sage -pip install badic [--user]")
from badic import *
In [3]:
# union of Rauzy fractals for the same Pisot number
# Tribonnacci and flipped Tribonnacci
s = WordMorphism('1->12,2->13,3->1')
t = WordMorphism('1->12,2->31,3->1')
a = DumontThomas(s).mirror().unshift([0,0])
b = DumontThomas(t).mirror().unshift([1,0,0,0,0])
m = a.union(b)
m.plot()
Out[3]:
In [4]:
# find a substitution whose Rauzy fractal is this beta-adic set
d = m.substitution()
s = WordMorphism(d)
print(s)
a->h, b->j, c->cd, d->jkv, e->cdj, f->jk, g->cdjk, h->lg, i->zcfz, j->lgz, k->cdjlh, l->cdjkv, m->zcfze, n->lgzcb, o->ljkv, p->mqcd, q->xio, r->xix, s->mqcdh, t->nrpav, u->lj, v->mq, w->nr, x->kptw, y->nrsv, z->spyu
In [5]:
# check
s.rauzy_fractal_plot()
Out[5]:
In [ ]:
 
In [30]:
#intersection of two Rauzy fractals with same Pisot number
m = DumontThomas(WordMorphism('1->12,2->31,3->1')).mirror()  # flipped Tribonnacci
m2 = DumontThomas(WordMorphism('1->12,2->13,3->1')).mirror() # Tribonnacci
m3 = m.intersection(m2) # compute the intersection of the two beta-adic set
m3.plot() # plot it
Out[30]:
In [32]:
# compute a substitution whose Rauzy fractal is this beta-adic set
%time d = m3.substitution()
s = WordMorphism(d)
print(s)
s.rauzy_fractal_plot()
CPU times: user 14.2 s, sys: 8 ms, total: 14.2 s
Wall time: 14.2 s
a->c, b->ba, c->bd, d->bg, e->id, f->be, g->h, h->bddfb, i->bdj, j->bek, k->idfb
Out[32]:
In [ ]:
 
In [28]:
# complementary of Rauzy fractals for the same Pisot number
# Tribonnacci minus flipped Tribonnacci
s = WordMorphism('1->12,2->13,3->1')
t = WordMorphism('1->12,2->31,3->1')
a = DumontThomas(s).mirror()
b = DumontThomas(t).mirror().unshift([1,0,0,0,0])
m = b.complementary(a)
m.plot()
Out[28]:
In [29]:
# compute a substitution whose Rauzy fractal is this beta-adic set
%time d = m.substitution()
s = WordMorphism(d)
print(s)
s.rauzy_fractal_plot()
CPU times: user 6.71 s, sys: 4 ms, total: 6.72 s
Wall time: 6.71 s
1->2,20, 10->9, 11->30,6, 12->30,10, 13->9,15, 14->13,18, 15->20,24, 16->20,11, 17->21,15, 18->20, 19->17, 2->2,20,24, 20->13,14, 21->13,15, 22->32,19, 23->16,27, 24->30, 25->23, 26->28,24, 27->31,25, 28->30,7, 29->28,12, 3->1, 30->29,22, 31->23,8, 32->23,26, 4->2, 5->30,3, 6->4, 7->4,18, 8->5,24, 9->4,15
Out[29]:
In [ ]:
 
In [15]:
# take Tribonnacci
m = DumontThomas(WordMorphism('a->ab,b->ac,c->a')).mirror()
# put a hole
m = m.unshift([1,0,0,0]).complementary(m); m
m.plot()
Out[15]:
In [16]:
# compute a substitution whose Rauzy fractal is this beta-adic set
d = m.substitution()
s = WordMorphism(d)
print(s)
s.rauzy_fractal_plot()
1->5, 2->51, 3->351, 4->3, 5->62, 6->42
Out[16]:
In [ ]:
 
In [12]:
# countable union of flipped Tribonnacci
s = WordMorphism('a->ab,b->ca,c->a')
m = DumontThomas(s).mirror()
m = BetaAdicSet(x^3-x^2-x-1, dag.AnyWord([0]).concat(dag.Word([1])).concat(dag.AnyWord([0]).concat(dag.Word([1,0,0,0,0]))).concat(m.a))
m.plot()
Out[12]:
In [13]:
# compute a substitution whose Rauzy fractal is this countable union
d = m.substitution()
s = WordMorphism(d)
print(s)
s.rauzy_fractal_plot()
1->29, 10->17,28, 11->18,30,46, 12->19, 13->31,20, 14->15,12, 15->22,30,46, 16->8,20, 17->8,21,28, 18->8,23,30,46, 19->22,14, 2->4, 20->15,24, 21->15,26,28, 22->18,23,30,46, 23->15,27,30,46, 24->25,20, 25->22,23,30,46, 26->25,21,28, 27->25,23,30,46, 28->42,1, 29->2, 3->32,45, 30->3,45, 31->31,30,46, 32->5,28, 33->13, 34->31,12, 35->35,28, 36->33, 37->34, 38->36, 39->37, 4->6, 40->35,45, 41->40,45, 42->41,46, 43->38, 44->39, 45->43, 46->44, 5->7,28, 6->9, 7->10,28, 8->11,30,46, 9->16
Out[13]:
In [ ]:
 
In [43]:
# Hokkaido
m = DumontThomas(WordMorphism('a->ab,b->c,c->d,d->e,e->a')).mirror()
m.plot()
Out[43]:
In [44]:
# draw something
m = m.user_draw()
m.plot()
Out[44]:
In [45]:
%time d = m.substitution()
s = WordMorphism(d)
print(s)
CPU times: user 1min 59s, sys: 11.9 ms, total: 1min 59s
Wall time: 1min 59s
1->20,28,23,1,12,27,23,29, 10->10,18,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18,12,27,23,9,20,28,23,1,12,27,23,29,8,15,..., 11->5,26,14,6, 12->8,15,24,21,2, 13->12,27,23,9,20,28,23,1,12,27,23,29, 14->7,19,15,23,22,26,14,15,11,15,23,17,15,24,25, 15->18,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25, 16->5,26,14,6,18,12,27,23,9,20,28,23,1,12,27,23,29, 17->20,28,23,1,12,27,23,29,8,15,24,21,2,13,14,16,12,27,23,29,7,19,15,23,22,26,14,3,15,2,20,4,12,27,23,29,7,19,15,23,..., 18->12,27,23,9,20,28,23,1,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18,12,27,23,9,20,28,23,1,..., 19->11,15,23,17,15,24,25, 2->5,26,14,6,18, 20->12,27,23,9, 21->19,15,23,22,26,14,15,11,15,23,17,15,24,25, 22->20,28,23,1,12,27,23,29,8,15,24,21,2, 23->5,26,14,6,18,12,27,23,9, 24->5,26,14,6,18,12,27,23,29,7, 25->19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18, 26->13,14,16,12,27,23,29,7,19,15,23,22,26,14,3,15,2,20,4,12,27,23,29, 27->13,14,16,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25, 28->20,28,23,1,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25, 29->20,28,23,1,12,27,23,29,8,15,24,21,2,13,14,16,12,27,23,29,7, 3->18,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6, 4->20,28,23,1,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18,12,27,23,9,20,28,23,1,12,27,23,29, 5->12,27,23,9,20,28,23,1,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18,12,27,23,9,20,28,23,1,..., 6->18,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,..., 7->19,15,23,22,26,14,3,15,2,20,4,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18,12,27,23,9,20,..., 8->19,15,23,22,26,14,3,15,2,20,4,12,27,23,29,7,19,15,23,22,26,14,15,11,15,23,17,15,24,25,5,26,14,6,18,12,27,23,9,20,..., 9->20,28,23,1,12,27,23,29,8,15,24,21,2,13,14,16,12,27,23,29,7,19,15,23,22,26,14,3,15,2,20,4,12,27,23,29,7,19,15,23,...
In [46]:
s.rauzy_fractal_plot()
Out[46]:
In [ ]: