%display latex
load("../specifier.py")
We consider the class $\mathcal T = \mathrm{Av}(2413,31452,41253,531642,41352)$. Its only simple permutation is $3142$, and the non-simple avoided patterns are $31452$,$41253$.
S = Specification([[3,1,4,2]],[[3,1,4,5,2],[4,1,2,5,3]])
S
C = S.sampler(0.1652) #see below the computation of the radius of convergence
perm = C.run(10)
list_plot(perm,aspect_ratio = 1)
Sage is not able to solve the system directly. However we can solve for $T_3,T_4$.
#S.solve() #sage cannot solve this
S.solve(part=[3,4])
We remark directly from the specification the identities $T_1 = T_2 = T_0/(1+T_0)$. We just computed $T_3 = z/(1-z)$. Substituting into the equation of $T_0$ gives a self-contained cubic equation for $T_0$.
equation = -T0 + S.system[0].subs(T1==T0/(1+T0),T2==T0/(1+T0),T3 = z/(1-z))
equation
poly_T0=(equation*(T0+1)).taylor(T0,0,5)
poly_T0
We play (not shown here) with Cardano's formulas to deduce that $\rho$ is the only real root of $-4z^9 + 41z^8 - 230z^7 + 507z^6 - 582z^5 + 403z^4 - 186z^3 +58z^2 - 12z + 1$, and that $T_0(\rho) = \frac {-21\rho^5 + 30\rho^4 + 12\rho^3 - 33\rho^2 + 15\rho - 3}{18\rho^5 - 78\rho^4 + 102\rho^3 - 66\rho^2 + 24\rho - 6}$.
poly = (-4*z^9 + 41*z^8 - 230*z^7 + 507*z^6 - 582*z^5 + 403*z^4 - 186*z^3 +58*z^2 - 12*z + 1).polynomial(ZZ)
K.<rho> = NumberField(poly, embedding=AA.polynomial_root(poly,RIF(0,0.2)))
T0rho =(-21*rho^5 + 30*rho^4 + 12*rho^3 - 33*rho^2 + 15*rho - 3)/(18*rho^5 - 78*rho^4 + 102*rho^3 - 66*rho^2 + 24*rho - 6)
T1rho,T2rho = T0rho/(1+T0rho),T0rho/(1+T0rho)
rho.n(),T0rho.n(),T1rho.n(),T2rho.n()
Let us check that these values verify the equation for $T_0,T_1,T_2$.
(T0rho,T1rho,T2rho)==(rho + T0rho*T1rho + T0rho*T2rho + (rho/(rho-1))^2*T0rho^2,rho + T0rho*T2rho + (rho/(rho-1))^2*T0rho^2,rho + T0rho*T1rho + (rho/(rho-1))^2*T0rho^2)
Now we compute $\mathbb M^\star(\rho, \mathbf T^\star(\rho))$, using an expression of $\mathbb M^\star$ obtained manually from the specification. We then compute the left and right eigenvectors. Note that the fact that $\mathbb M^\star(\rho, \mathbf T^\star(\rho))$ has eigenvalue $1$ confirms that we are indeed at the singularity.
M = Matrix([[T1rho + T2rho + 2*T0rho*(rho/(1-rho))^2,T0rho,T0rho],[T2rho + 2*T0rho*(rho/(1-rho))^2,0,T0rho],[T1rho + 2*T0rho*(rho/(1-rho))^2,T0rho,0]])
index_one = M.eigenvalues().index(1)
u = (M.left_eigenvectors()[index_one][1][0])
v = (M.right_eigenvectors()[index_one][1][0])
We move on to the computation of $p_+$. The expressions for $E_{i,j,j"}^{\pm}$ were obtained manually from the specification.
nplus = u[0]*v[1]*v[0] + u[2]*v[1]*v[0]
nminus = u[0]*v[2]*v[0] + u[1]*v[2]*v[0] + (rho/(1-rho))^2*(u[0]+u[1]+u[2])*(v[0])^2
pplus = nplus/(nplus+nminus)
pplus
pplus.n()
pplus.minpoly()