(*定义度规*)
WestCostMatric = {{1,0,0,0},{0,-1,0,0},{0,0,-1,0},{0,0,0,-1}};
EastCostMatric = {{-1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}};
MapIndexed[(Subscript[g,#2[[1]]-1,#2[[2]]-1]=#1)&,EastCostMatric,{2}];

(*Pauli矩阵*)
(Subscript[σ, 1])={{0,1},{1,0}};
(Subscript[σ, 2 ])={{0,-I},{I, 0}};
(Subscript[σ, 3])={{1,0}, {0, -1}};
I2 = {{1,0},{0,1}};

(*定义Dirac矩阵的不同表示方式*)
DiracRepresentation = {
ArrayFlatten[{{I2,0},{0,-I2}}],
ArrayFlatten[{{0,(Subscript[σ, 1])},{-(Subscript[σ, 1]),0}}],
ArrayFlatten[{{0,(Subscript[σ, 2])},{-(Subscript[σ, 2]),0}}],
ArrayFlatten[{{0,(Subscript[σ, 3])},{-(Subscript[σ, 3]),0}}]
} ;
WeylRepresentation = {
ArrayFlatten[{{0,I2},{I2,0}}],
ArrayFlatten[{{0,(Subscript[σ, 1])},{-(Subscript[σ, 1]),0}}],
ArrayFlatten[{{0,(Subscript[σ, 2])},{-(Subscript[σ, 2]),0}}],
ArrayFlatten[{{0,(Subscript[σ, 3])},{-(Subscript[σ, 3]),0}}]
} ;
MajoranaRepresentation = {
ArrayFlatten[{{0,(Subscript[σ, 2])},{(Subscript[σ, 2]),0}}],
ArrayFlatten[{{I (Subscript[σ, 3]),0},{0,I (Subscript[σ, 3])}}],
ArrayFlatten[{{0,-(Subscript[σ, 2])},{(Subscript[σ, 2]),0}}],
ArrayFlatten[{{-I (Subscript[σ, 1]),0},{0,-I (Subscript[σ, 1])}}]
};
MapIndexed[(Superscript[γ,First[#2]-1]=#1)&,DiracRepresentation];
(*MapIndexed[(Superscript[γ,First[#2]-1]=#1)&,WeylRepresentation];*)
(*MapIndexed[(Superscript[γ,First[#2]-1]=#1)&,MajoranaRepresentation ];*)
Do[Subscript[γ,μ]=(∑_(ν=0)^3)(Subscript[g, μ,ν])Superscript[γ,ν],{μ,0,3}]

(*((定义γ)^5)以及投影算符*)
Superscript[γ,5]=I Superscript[γ,0].Superscript[γ,1].Superscript[γ,2].Superscript[γ,3];
I4 = {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}} ;
PL = ((I4-Superscript[γ,5])/2) ;
PR = ((I4+Superscript[γ,5])/2) ;

(*Dirac方程中的α和β*)
Superscript[α,1] = Superscript[γ,0] .Superscript[γ,1];
Superscript[α,2] = Superscript[γ,0] .Superscript[γ,2];
Superscript[α,3] = Superscript[γ,0] .Superscript[γ,3];
β=Superscript[γ,0] // MatrixForm

Print[Superscript[α,3]//HoldForm//TeXForm,"=",Superscript[α,3]//MatrixForm // TeXForm]

(*Spin 1/2绕z轴的旋转矩阵：*)
Sz = I2 Cos[(ϕ/2)]-I (Subscript[σ, 3]) Sin[(ϕ/2)];
(*旋转矩阵*)
Rotationz = {{1,0,0,0},{0,Cos[ϕ],Sin[ϕ],0},{0,-Sin[ϕ],Cos[ϕ],0},{0,0,0,1}} ;
MapIndexed[(Subscript[Rz,#2[[1]]-1,#2[[2]]-1]=#1)&,Rotationz,{2}];
(Subscript[γ, 1])
Sz
Inverse[Sz].(Subscript[γ, 1]).Sz