r"""
Rmatrices for U_q(sl_2).
R1 and R2 are the Boltzmann weights for the matrices
R, and R' in Proposition 4.3 of Lecture 13. The matrix
used in the linear combination R+z*R'. We need to
check that this is a parametrized YangBaxter
equation.
To check the
YangBaxter equation, try this:
sage: [f.factor() for f in equations()]
Examination of the output shows there are three
solutions (up to constant multiple): we can have
t=0, or u=0, or u=q^2*t. However the last solution
just gives the identity matrix, so we see that R and R'
in Proposition 4.3 are the only solutions.
About the tetragrams: "abcd" is the Boltzmann weight
of the vertex with boundary values a,b,c,d in either
of the two following configurations:
b c
\ /
X
/ \
a d
or:
b

a + c

d
"""
PR. = PolynomialRing(QQ)
spins = ["+",""]
R1weights={"++++":1,
"":1,
"++":q,
"++":q,
"++":1q^2,
"++":0
}
R2weights={"++++":1,
"":1,
"++":1/q,
"++":1/q,
"++":0,
"++":11/(q^2)
}
Rweights={k:R1weights[k]z*q^2*R2weights[k] for k in R1weights}
Sweights={k:R1weights[k]z*w*q^2*R2weights[k] for k in R1weights}
Tweights={k:R1weights[k]w*q^2*R2weights[k] for k in R1weights}
def R(a,b,c,d):
tet = a+b+c+d
return Rweights.get(tet,0)
def S(a,b,c,d):
tet = a+b+c+d
return Sweights.get(tet,0)
def T(a,b,c,d):
tet = a+b+c+d
return Tweights.get(tet,0)
lhs_template = r"""
%s
\

%s %s  v  %s
\ / 
r %s %s
/ \ 
%s %s  w  %s

/
%s
"""
rhs_template = r"""
%s
/

%s  w  %s %s
 \ /
%s r %s
 / \
%s  v  %s %s

\
%s
"""
def ybez(data,verbose=True):
r"""
c c
\ /
 
b g  S  d b  T  j d
\ /   \ /
R h k R
/ \   / \
a i  T  e a  S  l e
 
/ \
f f
Usage:
ybez("++++")
Calculates both sides of the YangBaxter equation with
boundary conditions a,b,c,d,e,f = + +  +  .
"""
(a,b,c,d,e,f) = [x for x in data]
lhs = 0
for g in spins:
for h in spins:
for i in spins:
term = R(a,b,g,i)*S(g,c,d,h)*T(i,h,e,f)
if verbose and term:
print (lhs_template%(c,b,g,d,h,term,a,i,e,f))
lhs += term
rhs = 0
for j in spins:
for k in spins:
for l in spins:
term = T(b,c,j,k)*S(a,k,l,f)*R(l,j,d,e)
if verbose and term:
print (rhs_template%(c,b,j,d,k,term,a,l,e,f))
rhs += term
return lhsrhs
def equations(mode="list", verbose=True):
"""
Checks all cases of the YangBaxter equation.
To return a dictionary of failing equations, use mode="dict".
"""
if mode=="dict":
ret = {}
else:
ret = []
for a in spins:
for b in spins:
for c in spins:
for d in spins:
for e in spins:
for f in spins:
yz = ybez(a+b+c+d+e+f,verbose=False)
if verbose:
print (f"{a+b+c+d+e+f} : {yz}")
if yz != 0:
if mode == "dict":
ret[a+b+c+d+e+f]=yz
else:
ret.append(yz)
return ret