The Group SU(3)

956 days ago by sweetser

r""" SU(3) - takes 8 generators of this group to make an element of SU(3) with a norm of one. Takes a quaternion, uses an exponential function on the 3-vector to get SU(2), then normalize the quaternion for U(1), and take the product. Do this for another quaternion. Take the conjugate of the first and multiply it by the second (if the conjugate step were skipped, one would have the same product table as U(1)xSU(2)). Can be fed different streams of quaternions, so there is no "correct" look, other than it must be a subgroup of the completely random quaternions fed into this function. There is no bias on the quaternion unit sphere. AUTHORS: -- Doug Sweetser (2009): Initial version. EXAMPLES: Test the group SU(3). sage: sage: True """ #***************************************************************************** # Copyright (C) 2009 Doug Sweetser <sweetser@alum.mit.edu> # # Distributed under the terms of the GNU General Public License (GPL) # http://www.gnu.org/licenses/ #***************************************************************************** 
       
class q(list): def __init__(self,t,x,y,z): self.t = t self.x = x self.y = y self.z = z self.qn = [] list.__init__(self,[t,x,y,z]) def __repr__(self): return "The group U(1)." def show(self): print self.t, self.x, self.y, self.z def vector(self): return q(0, self.x, self.y, self.z) def normalize(self): abs_value = sqrt(self.t^2 + self.x^2 + self.y^2 + self.z^2) return q(self.t/abs_value, self.x/abs_value, self.y/abs_value, self.z/abs_value) def conj(self): return q(self.t, -self.x, -self.y, -self.z) def n_random(self, n): self.qn[:]=[] for i in range(n): self.qn.append(q(2 * random() - 1, 2 * random() - 1, 2 * random() - 1, 2 * random() - 1)) return self def random(self): return q(2 * random() - 1, 2 * random() - 1, 2 * random() - 1, 2 * random() - 1) def times(self, q2): return q(self.t * q2.t - self.x * q2.x - self.y * q2.y - self.z * q2.z, self.t * q2.x + self.x * q2.t + self.y * q2.z - self.z * q2.y, self.t * q2.y + self.y * q2.t + self.z * q2.x - self.x * q2.z, self.t * q2.z + self.z * q2.t + self.x * q2.y - self.y * q2.x) # exp(q) = (exp(t) cos(|R|), exp(t) sin(|R|) R/|R|) def exp(self): abs_vector = sqrt(self.x^2 + self.y^2 + self.z^2) if abs_vector == 0: return q(exp(self.t), 0, 0, 0) k = exp(self.t) * sin(abs_vector) / abs_vector return q(exp(self.t) * cos(abs_vector), k * self.x, k * self.y, k * self.z) def su2(self): return self.vector().exp() def u1(self): return self.normalize() def u1xsu2(self): return self.su2().times(self.u1()) def su3(self, q2): return self.u1xsu2().conj().times(q2.u1xsu2()) #auto 
       
# Test q1 = q(1., 2., 3., 4.); q2 = q(5., 6., 7., 8.) q1.su3(q2).show() 
       
.9412067025831878 
                               .2200672956194497 
                               .1508144031131397 
                               .2072567109283837
.9412067025831878 
                               .2200672956194497 
                               .1508144031131397 
                               .2072567109283837
q1 = q(1., 2., 3., 4.) q1.u1().show() q1.su2().show() q1.u1xsu2().show() 
       
0.182574185835055 0.365148371670111 0.547722557505166 0.730296743340221

                               .6231593449762197 
                              - .2904627534478825 
                              - .4356941301718237 
                              - .5809255068957649

                               .8827223205837953 
                               .1745146193829238 
                               .2617719290743858 
                               .3490292387658477
0.182574185835055 0.365148371670111 0.547722557505166 0.730296743340221

                               .6231593449762197 
                              - .2904627534478825 
                              - .4356941301718237 
                              - .5809255068957649

                               .8827223205837953 
                               .1745146193829238 
                               .2617719290743858 
                               .3490292387658477
for r in range(10): q1.random().su3(q1.random()).show() 
       
.4413525476399216 
                               .6932178596314106 
                             - .09124331881390896 
                               .5624336267966379

                               .9509401846063668 
                              - .2387419499266112 
                               .1665150528397225 
                               .1048226303039229

                               .5853626520931038 
                              - .1896507406363558 
                              - .4096891969710261 
                              - .6734522432926071

                              .08878856306633184 
                               .2101816259286445 
                               .7695495230157001 
                              - .5964342434979025

                               .9654033315778225 
                              - .1047732491701631 
                              - .1753121140927999 
                              - .1621253721324361

                               .8432373995435933 
                              - .3009858296643538 
                              - .4315097806019015 
                               .1102611790120059

                               .6026664672300875 
                              .05285668480088493 
                               .5304223261493607 
                              - .5938446396748622

                               .8919729108976091 
                              - .2340015774169549 
                               .3827432728294715 
                             - .05599263429244405

                               0.81599604626527 
                               .4070896066826075 
                              - .1756147967408008 
                               .3709284941550521

                               .6152021246523137 
                             - .02966069458653648 
                               .2657711289412499 
                               .7416281386525303
.4413525476399216 
                               .6932178596314106 
                             - .09124331881390896 
                               .5624336267966379

                               .9509401846063668 
                              - .2387419499266112 
                               .1665150528397225 
                               .1048226303039229

                               .5853626520931038 
                              - .1896507406363558 
                              - .4096891969710261 
                              - .6734522432926071

                              .08878856306633184 
                               .2101816259286445 
                               .7695495230157001 
                              - .5964342434979025

                               .9654033315778225 
                              - .1047732491701631 
                              - .1753121140927999 
                              - .1621253721324361

                               .8432373995435933 
                              - .3009858296643538 
                              - .4315097806019015 
                               .1102611790120059

                               .6026664672300875 
                              .05285668480088493 
                               .5304223261493607 
                              - .5938446396748622

                               .8919729108976091 
                              - .2340015774169549 
                               .3827432728294715 
                             - .05599263429244405

                               0.81599604626527 
                               .4070896066826075 
                              - .1756147967408008 
                               .3709284941550521

                               .6152021246523137 
                             - .02966069458653648 
                               .2657711289412499 
                               .7416281386525303
r""" Note: has a bias for positive numbers like U(1)xSU(2). """ 
       
r""" Elements of the group SU(3) which is the group for the gauge symmetry of the strong force. This also has as subgroups U(1), SU(2), and U(1)xSU(2), electromagnetism, the weak force, and the electroweak force respectively. Together there are 8 elements of a Lie algebra, which is smaller than appears in the standard model. """