In [34]:
%display latex
In [35]:
load("../specifier.py")

We consider the class $\mathcal T = \mathrm{Av}(2413,1243,2341,531642,41352)$. Its only simple permutation is $3142$,and the non-simple avoided patterns are $2143$ and $34512$.

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

We can check that critical families are $\mathcal T_0,\mathcal T_4,\mathcal T_{11}$, with $\{\mathcal T_4,\mathcal T_{11}\}$ forming a strongly connected component, and that we are in the essentially linear case. We find below that smallest root $\rho$ of the denominator of $T_0$. Hence $\rho$ is the radius of convergence of our class. We store a numerical approximation along with its minimal polynomial.

In [39]:
S.solve()[0].denominator().factor()
Out[39]:
In [40]:
poly = 2*z^5-7*z^4+14*z^3-13*z^2+6*z-1
In [41]:
rho_approx = poly.find_root(0,1)
In [42]:
rho_approx
Out[42]:
In [43]:
#plot(S.solve()[0].denominator().factor(),0,rho_approx) #uncomment to check that there are no other roots before rho
In [44]:
C = S.sampler(0.335)
In [45]:
perm = C.run(10)
In [46]:
list_plot(perm)
Out[46]:

It seems that the limit is a X-permuton with $p_{\mathrm{left}}^+ = p_{\mathrm{right}}^-$. Indeed we are in the essentially linear case. We need to perform the analysis on a specification where critical families are strongly connected, that is $\{\mathcal T_{4}, \mathcal T_{11}\}$. As $\mathcal T_{11} \subset \mathcal T_{0}$ and $\mathcal T_{0} \setminus \mathcal T_{11}$ has a smaller growth rate than $\mathcal T_{0}$ (see below), these classes have the same asymptotics.

In [47]:
(S.solve()[0] - S.solve()[11]).simplify_full()
Out[47]:

To compute the parameters of the limit permuton, 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},-}$.

In [48]:
M,Dlp,Drp,Dlm,Drm = S.linear_analysis([4,11])
In [49]:
M,Dlp,Drp,Dlm,Drm
Out[49]:

We see that $\mathbb D^{\mathrm{right},-}$ and $\mathbb D^{\mathrm{left},+}$ are identically $0$. Hence we know immediately that $p_{\mathrm{left}}^+ = p_{\mathrm{right}}^-$.

In [17]:
plp,prm = 0,0

We create the number field $K = \mathbb Q(\rho)$ in which we will perform our computations. We specify the approximate value of $\rho$ for numerical evaluation purposes.

In [18]:
K.<rho> = NumberField(2*z^5 - 7*z^4 + 14*z^3 - 13*z^2 + 6*z - 1,embedding = RR(rho_approx))

We apply the matrices of interest in $z=\rho$.

In [19]:
Mrho = apply_symbolic_matrix(M,QQ,z,rho)
Drprho = apply_symbolic_matrix(Drp,QQ,z,rho)
Dlmrho = apply_symbolic_matrix(Dlm,QQ,z,rho)
In [20]:
Mrho,Dlmrho,Drprho
Out[20]:

The CAS has simplified the expression of $\mathbb M^\star(\rho), \mathbb D^{\mathrm{left},-}(\rho),\mathbb D^{\mathrm{right,+}}(\rho)$ 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 [21]:
index_one = Mrho.eigenvalues().index(1)
In [22]:
u = Matrix(Mrho.left_eigenvectors()[index_one][1][0])
In [23]:
v = transpose(Matrix(Mrho.right_eigenvectors()[index_one][1][0]))

We are now able to compute $p^{\mathrm{left},-}$ and $p^{\mathrm{right},+}$. Since the other two probabilities are $0$, we have $p^{\mathrm{right},+} = 1-p^{\mathrm{left},-}$. We then compute a numerical approximation and the minimal polynomial of $p^{\mathrm{left},-}$.

In [24]:
plm,prp = (u*Dlmrho*v)[0,0]/((u*Dlmrho*v)[0,0]+(u*Drprho*v)[0,0]),(u*Drprho*v)[0,0]/((u*Dlmrho*v)[0,0]+(u*Drprho*v)[0,0])
In [25]:
plm
Out[25]:
In [26]:
plm.n()
Out[26]:
In [27]:
19168*minimal_polynomial(plm)
Out[27]:

We plot the shape of the limiting permuton.

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