The following example is an attempt to answer
https://groups.google.com/d/msg/fricas-devel/UxxF97W5tXA/EYbkeCBZYJsJ
(see also the mail following this post)
fricas
Q ==> Fraction Integer
Type: Void
fricas
V ==> OrderedVariableList(['y11,'y12,'y21,'y22])
Type: Void
fricas
v := enumerate()$V
fricas
X ==> XDistributedPolynomial(V, Q)
Type: Void
fricas
z11: X := v.1
fricas
z12: X := v.2
fricas
z21: X := v.3
fricas
z22: X := v.4
fricas
q: Matrix X := matrix [[z11, z12],[z21,z22]]
fricas
K := kroneckerProduct(q, q)
fricas
MM: Matrix(Q) :=matrix([[1,0,0,1], [0,1,1,0], [0,1,-1,0], [1,0,0,-1]])
Type: Matrix(Fraction(Integer))
fricas
T := MM*K*inverse(MM)
fricas
r1 := (z11*z11+z21*z21-1)
fricas
r2 := (z11*z11+z12*z12-1)
fricas
r3 := (z12*z12+z22*z22-1)
fricas
r4 := (z21*z21+z22*z22-1)
fricas
r5 := (z11*z12+z21*z22)
fricas
r6 := (z11*z21+z12*z22)
fricas
r7 := (z12*z11+z22*z21)
fricas
r8 := (z21*z11+z22*z12);
fricas
sigma ==> 1111;
Type: Void
fricas
r9 := z11*z22+z12*z21-sigma
fricas
ra := (z11*z22-z22*z11)
fricas
rb := (z12*z21-z21*z12)
fricas
rc := (z11*z12+z12*z11)
fricas
rd := (z21*z22+z22*z21)
fricas
re := (z11*z21+z21*z11)
fricas
rf := (z22*z12+z12*z22)
fricas
t11 := 2*T(1,1) - r3 - r1
fricas
t12 := 2*T(1,2) - r7 - r5
fricas
t21 := 2*T(2,1) - r8 - r6
fricas
t22 := 2*T(2,2) + ra + rb - 2*r9