In [1]:
%display latex 
In [2]:
load("../specifier.py")

We consider the class $\mathcal T = \mathrm{Av}(2413,3142, 2143,34512)$. It contains no simple permutation, and the non-simple avoided patterns are $2143$ and $34512$.

In [3]:
S = Specification([],[[3,4,5,1,2],[2,1,4,3]])
In [4]:
S
Out[4]:
In [5]:
S.solve()
Out[5]:

We can check that critical families are those with the same denominator as $\mathcal T_0$, that is $\mathcal T_0,\mathcal T_3,\mathcal T_7,\mathcal T_8,\mathcal T_{12},\mathcal T_{13}$, that removing $\mathcal T_0$ yields a strongly connected critical component, and that we are in the essentially linear case. We see below that the denominator of $T_0$ has two real roots, $1$ and $\rho<1$. Then $\rho$ is the radius of convergence of our class. We store it (seen by sage as an element of the algebraic field) along with its minimal polynomial.

In [6]:
S.solve()[0].denominator().factor()
Out[6]:
In [7]:
poly = z^3-z^2+4*z-1
In [8]:
[x.n() for x in poly.roots(multiplicities=False)]
Out[8]:
In [9]:
rho_alg = AA(poly.roots(multiplicities=False)[2])
In [10]:
rho_alg.n()
Out[10]:

We may now perform a Boltzmann sampling close to the radius of convergence.

In [11]:
C = S.sampler(0.260)
In [12]:
perm = C.run(10)
In [13]:
list_plot(perm)
Out[13]:

It seems that the limit is a X-permuton. Indeed we are in the essentially linear case. To compute the parameters of the limiting permuton of the classes $\mathcal T_3,\mathcal T_7,\mathcal T_8,\mathcal T_{12},\mathcal T_{13}$, we retrieve from the specification the matrices $\mathbb M^\star, \mathbb D^{\mathrm{left},+},\mathbb D^{\mathrm{right},+},\mathbb D^{\mathrm{left},-},\mathbb D^{\mathrm{right},-}$ that appear in the analysis of the limit shape.

In [14]:
M,Dlp,Drp,Dlm,Drm = S.linear_analysis([3,4,7,8,12,13])
In [15]:
M,Dlp,Drp,Dlm,Drm
Out[15]:

We need to compute the value of those matrices at $z=\rho$. To that end, we will work in the number field $\mathbb Q(\rho)$.

In [16]:
K.<rho> = NumberField(poly,embedding = rho_alg)
In [17]:
Mrho = apply_symbolic_matrix(M,QQ,z,rho)
Dlprho = apply_symbolic_matrix(Dlp,QQ,z,rho)
Drprho = apply_symbolic_matrix(Drp,QQ,z,rho)
Dlmrho = apply_symbolic_matrix(Dlm,QQ,z,rho)
Drmrho = apply_symbolic_matrix(Drm,QQ,z,rho)
In [18]:
Mrho,Dlprho,Drprho,Dlmrho,Drmrho
Out[18]:

The CAS has simplified the expression of $\mathbb M^\star, \mathbb D^{\mathrm{left},+},\mathbb D^{\mathrm{right},+},\mathbb D^{\mathrm{left},-},\mathbb D^{\mathrm{right},-}$ thanks to the knoweldge of the minimal polynomial of $\rho$.

Let us now compute the left and right eigenvectors of $\mathbb M^\star(\rho)$.

In [19]:
index_one = Mrho.eigenvalues().index(1)
In [20]:
u = Matrix(Mrho.left_eigenvectors()[index_one][1][0])
In [21]:
v = transpose(Matrix(Mrho.right_eigenvectors()[index_one][1][0]))

We are now able to compute the vector $\mathbf p$.

In [22]:
nlp,nrp,nlm,nrm = (u*Dlprho*v)[0,0],(u*Drprho*v)[0,0],(u*Dlmrho*v)[0,0],(u*Drmrho*v)[0,0]
In [23]:
norm = nlp+nrp+nlm+nrm
In [24]:
plp,prp,plm,prm=nlp/norm,nrp/norm,nlm/norm,nrm/norm

The vector $\mathbf p$ is expressed in terms of $\rho$, we can then compute numerical approximations, minimal polynomials and radical expressions for those numbers.

In [25]:
(597*plp,597*prp,597*plm,597*prm)
Out[25]:
In [26]:
(plp.n(),prp.n(),plm.n(),prm.n())
Out[26]:
In [27]:
AA(plp).minpoly()*199, AA(prp).minpoly()*199, AA(plm).minpoly()*597, AA(prm).minpoly()*597
Out[27]:
In [28]:
AA(plp).radical_expression(), AA(prp).radical_expression(), -(5879/290142- 4879/6415362*sqrt(597))^(1/3) - 2*649/32238/(5879/290142-4879/6415362*sqrt(597))^(1/3) + 8/9, AA(prm).radical_expression()
Out[28]:

For plm the radical expression given by sage was a bit funky so we simplified it by hand. Let us check we did not do any mistake.

In [29]:
AA(-(5879/290142- 4879/6415362*sqrt(597))^(1/3) - 2*649/32238/(5879/290142-4879/6415362*sqrt(597))^(1/3) + 8/9) == AA(plm)
Out[29]:

We plot the shape of the limiting permuton.

In [30]:
show(plot_X_permuton(plp,plm,prp,prm),aspect_ratio=1, axes = False)