Hi, my name is Moises Zeleny, I am from Mexico, and I am studyng a PhD on 
applied physics, particularly I am working on Model building in particle 
physics, I am a begginer in sympy programming but I think sympy is very 
useful for physics calculation. I would like to build my own python program 
to do a similar things like feynarts and feynrules in Mathematica. My first 
step, I have been using sympy to do all algebra manipulations to reproduce 
the Standard Model of particles physics and some its extensions. But I want 
to go to the next level. For example, with sympy symbols I can find all 
posible vertices (interactions) in my Lagrangian, and my program give me a 
list :

interactions_list = [[h,f,fb],[h,W,W],[h,Z,Z],[h,gamma,gamma],[Z,f,fb]
                     ,[gamma,f,fb],[Z,f,fb]]
Then with the sublist [h,W,W], [h,f,f], ... I can construct some feynman 
diagrams permited in my Lagrangian. For example I can construct all allowed 
2 ->1 ->2 process using the next class

class Vertice3(Expr):
    
    def __init__(self,x1,x2,x3):
        self.x1 = x1
        self.x2 = x2
        self.x3 = x3
    
    def __str__(self):
        return '{a}{b}{c}'.format(a=latex(self.x1), b=latex(self.x2),\
                                           c=latex(self.x3))
    
    def __repr__(self):
        return self.__str__()
    
    def __eq__(self,other):
        q1,q2,q3 = self.x1,self.x2,self.x3
        k1,k2,k3 = other.x1,other.x2,other.x3
        return (q1==k1 and q2==k2 and q3==k3) or (q1==k2 and q2==k3 and 
q3==k1) or (q1==k3 and q2==k1 and q3==k2) \
               or (q1==k1 and q2==k3 and q3==k2) or (q1==k2 and q2==k2 and 
q3==k3) or (q1==k3 and q2==k2 and q3==k3)
    # definimos como va a funcionar el operador in para la clase Vertice3
    def __contains__(self,obj):
        return obj==self.x1 or obj==self.x2 or obj==self.x3

##########################################
and the function:
#########################################


def diagramas121(p1,p2,interacciones):
    pi = p1 # initial particles
    pf = p2 # final particles
    propagadores = []
    diagramas = []
    vertices = [Vertice3(*inte) for inte in interacciones]
    for vertex in vertices:
        if pi in vertex:
            if pi==vertex.x1:
                propagadores.append([vertex.x2,vertex.x3])            
            elif pi==vertex.x2:
                propagadores.append([vertex.x1,vertex.x3])
            else:
                propagadores.append([vertex.x1,vertex.x2])
    for vertex in vertices:
        for prop in propagadores:
            if (prop[0]==vertex.x1 and prop[1]==vertex.x2 and 
pf==vertex.x3) or\
            (prop[0]==vertex.x2 and prop[1]==vertex.x3 and pf==vertex.x1) 
or\
            (prop[0]==vertex.x3 and prop[1]==vertex.x1 and pf==vertex.x2) 
or\
            (prop[0]==vertex.x2 and prop[1]==vertex.x1 and pf==vertex.x3) 
or\
            (prop[0]==vertex.x1 and prop[1]==vertex.x3 and pf==vertex.x2) 
or\
            (prop[0]==vertex.x3 and prop[1]==vertex.x2 and 
pf==vertex.x1):            
                diagramas.append([pi,prop,pf])
                propagadores.remove(prop)
    return diagramas

for example with the next code: 
##########
h,W,f,fb,gamma,Z = symbols(r'h,W,f,\overline{f},\gamma,Z')

interactions_list = [[h,f,fb],[h,W,W],[h,Z,Z],[h,gamma,gamma],[Z,f,fb]
                     ,[gamma,f,fb],[Z,f,fb]]

diagramas212([f,fb],[f,fb],interactions_list)
##########333

The I obteind the next list:

[[f,fb,[h],[f,fb]], [f,fb,[Z],[f,fb]],[f,fb,[gamma],[f,fb]]]

I would like to give some properties of each symbols (particle), like four 
momentum or the corresponding Dirac Spinor (at the fermion case (f)) or 
propagator for h and f. Then calculate for example the amplitude for each 
process. I have thought in a structure like this:

M = fb.spinor()*ghff*f.spinor()*h.propagator()*fb.spinor()*ghff*f.spinor()

where ghff represent the coupling constant between h and f , fb which I can 
calculate with sympy. Can someone give me some suggestions for do it?

Thanks in advance and I am sorry for my grammar.

[[f,f⎯⎯⎯,[h],f,f⎯⎯⎯],[f,f⎯⎯⎯,[Z],f,f⎯⎯⎯],[f,f⎯⎯⎯,[γ],f,f⎯⎯⎯]][[f,f⎯⎯⎯,[h],f,
f⎯⎯⎯],[f,f⎯⎯⎯,[Z],f,f⎯⎯⎯],[f,f⎯⎯⎯,[γ],f,f⎯⎯⎯]]

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/70c6f25f-c3b6-45cd-9d99-2b1db213051e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to