(* Checking the solution of hexagon equation *)
φ=((1+(Sqrt[5]))/2);
N[φ];
x=Exp[I 4π/5]; y=Exp[-I 3π/5]; (* left-handed solution *)
(RFR=(({{x^2/φ, x y /(Sqrt[φ])}, {x y /(Sqrt[φ]), -y^2/φ}})))//MatrixForm
(FRF=(({{y /φ+ 1/(φ^2), φ^(-3/2)(1-y)}, {φ^(-3/2)(1-y), y /(φ^2)+ 1/φ}})))//MatrixForm
FullSimplify[RFR-FRF]//MatrixForm
Chop[N[RFR-FRF]]//MatrixForm

φ=((1+(Sqrt[5]))/2);
x=Exp[I 4π/5]; y=Exp[-I 3π/5]; (* left-handed solution *)

(* The fusion matrix F=(Subscript[F, τ]^(τττ)) in the basis of left standard trees {|0>, |1>} *)
(F=(({{1/φ, 1 /(Sqrt[φ])}, {1 /(Sqrt[φ]), -1/φ}})))//MatrixForm
FullSimplify[F.F]//MatrixForm
FullSimplify[Det[F]]

(* R-matrix; in the basis {|0>, |1>} it also gives the braiding matrix B12 ≡ (Subscript[σ, 1]) = R *)
(R=(({{x, 0}, {0, y}})))//MatrixForm

(* Brading matrix B23 ≡ (Subscript[σ, 2]) *)
(B23=Simplify[F.R.F])//MatrixForm
(S2=(({{1/(x φ), 1 /(y(Sqrt[φ]))}, {1 /(y(Sqrt[φ])), -1/φ}})))//MatrixForm
FullSimplify[S2-B23]//MatrixForm

(* All matrices below are given in the basis {|0>, |1>}, which is a basis of a computation space *)
φ=((1+(Sqrt[5]))/2);
x=Exp[-I 4π/5]; y=Exp[I 3π/5]; (* right-handed solution *)

(* Distance between two unitary matrices *)
Dist=Function[{U,V},Sqrt[1-Abs[Tr[ConjugateTranspose[U].V]]/2]]

(* Braiding matrix (Subscript[σ, 1]) *)
(S1=(({{x, 0}, {0, y}})))//MatrixForm
(* Braiding matrix (Subscript[σ, 1]^(-1)) *)
(S1I=(({{1/x, 0}, {0, 1/y}})))//MatrixForm

(* Braiding matrix (Subscript[σ, 2]) *)
(S2=(({{1/(x φ), 1 /(y(Sqrt[φ]))}, {1 /(y(Sqrt[φ])), -1/φ}})))//MatrixForm
(* Braiding matrix (Subscript[σ, 2]^(-1)) *)
(S2I=Simplify[Inverse [S2]])//MatrixForm

(* The figures below refer to the book of Steven Simon, chapter 11 *)

(* Short braid to approximate X-gate, Fig. 11.5 *)
Chop[U=N[y S2I.S1.S1.S1.S2I]]//MatrixForm (* the overal phase plays no role *)
Dist[PauliMatrix[1],U]

(* Long braid to approximate X-gate,  Fig. 11.6  *)
Chop[U=N[S1I.S1I.S2.S2.S2.S1.S1.S2I.S2I]]//MatrixForm;
Chop[ I U/Sqrt[Det[U]]]//MatrixForm
Dist[PauliMatrix[1],U]

(* Weave to approximate X-gate, Fig. 11.7  *)
Chop[U=N[S2.S2.S2.S2.S1I.S1I.S2.S2.S1I.S1I]]//MatrixForm;
Chop[ I U/Sqrt[Det[U]]]//MatrixForm
Dist[PauliMatrix[1],U]

(* Weave to approximate ((((Subscript[σ, 1])))^2)-gate, Fig. 11.10  *)
Chop[U=N[S2.S2.S2.S1I.S1I.S1I.S1I.S2I.S2I.S1.S1.S1.S1.S2I.S2I.S2I.S2I.S1I.S1I.S1I.S1I.S2I]]//MatrixForm;
Chop[ U/y^2]//MatrixForm
Chop[N[S1.S1/y^2]]//MatrixForm
Dist[S1.S1,U]

(* The matrices below are given in the basis {|N>, |0>, |1>}, which is a basis of the full fusion space of three τ-anyons *)
φ=((1+(Sqrt[5]))/2);
x=Exp[-I 4π/5]; y=Exp[I 3π/5]; (* right-handed *)
Dist=Function[{U,V},Sqrt[1-Abs[Tr[ConjugateTranspose[U].V]]/3]]

(* Braiding matrix (Subscript[σ, 1]) *)
(S1={{y,0,0},{0, x,0},{0,0,y}})//MatrixForm
(* Braiding matrix (Subscript[σ, 1]^(-1)) *)
(S1I={{1/y,0,0},{0, 1/x,0},{0,0,1/y}})//MatrixForm

(* Braiding matrix (Subscript[σ, 2]) *)
(S2={{y,0,0},{0, 1/(x φ),1 /(y(Sqrt[φ]))},{0,1 /(y(Sqrt[φ])),-1/φ}})//MatrixForm
(* Braiding matrix (Subscript[σ, 2]^(-1)) *)
(S2I=Simplify[Inverse[S2]])//MatrixForm
Simplify[S2.S2I]//MatrixForm;

(* Weave to approximate ((((Subscript[σ, 1])))^2)-gate, Fig. 11.10  *)
Chop[U=N[S2.S2.S2.S1I.S1I.S1I.S1I.S2I.S2I.S1.S1.S1.S1.S2I.S2I.S2I.S2I.S1I.S1I.S1I.S1I.S2I]]//MatrixForm;
N[Abs[Det[U]]]
Chop[U/y^2 ]//MatrixForm
Chop[N[S1.S1/y^2 ]]//MatrixForm
Dist[S1.S1,U]