[Edu-sig] more in the "Rich Data Structure" series

kirby urner kirby.urner at gmail.com
Mon Dec 3 04:22:27 CET 2012


"""
Quantum Field Theory:
Skeletal draft of objects

Rich Data Series

To help with studies, students learning Python might bend its
notation to help them wrap their heads around this and that.
Here's a module I've been working on after listening to
Sean Carroll's ISEPP lecture in Portland last night (isepp.org).

Write-up:
http://worldgame.blogspot.com/2012/11/isepp-physics-lecture.html

I haven't double checked everything as the primary idea is
to get across the idea.  People will role their own.  These are
more in the way of doodles at this point, minus much of
anything to hold it together.  Slapping it out there as open
source.

If you fix a broken bit, fork a new version,
take it as inspiration to start from scratch, feel free to
add your name to the list of contributors.  Many of you have
already.  My thanks to the Wikipedia articles and other
authors I read and/or listened to or otherwise appreciated.

Other Rich Data Structure stuff

http://mail.python.org/pipermail/edu-sig/2005-November/005533.html
http://www.mail-archive.com/edu-sig@python.org/msg02457.html
http://mybizmo.blogspot.com/2008/01/rich-data-structures.html

K. Urner
edu-sig

"""

ANTI = True

class Fermion():
    """fractional spin, Fermi-Dirac statistics"""
    spin = 1/2  # J

class Boson():
    """whole number spin, Bose-Einstein statistics"""
    spin = 0  # may override in subclass to 1 or 2 (Higgs)

class Field:
    pass

class Strong(Field):
    """
    quantum chromodynamics
    """
    def __init__(self, anti=False):
        self.anti = anti
        if anti:
            self.color = "anti-" + self.color  # reverse color if anti-particle

class ElectroWeak(Field):
    """
    quantum electrodynamics
    """
    def __init__(self, anti=False):
        self.anti = anti
        if anti:
            self.charge = -self.charge  # reverse charge if anti-particle


# Quarks: 6 with oppositely charged pairs = 12, each with 3 colors =
36 permutations
class Quark(Fermion, Strong, ElectroWeak):
    """
    Meson = Quark + Quark
    Baryon = Quark + Quark + Quark (e.g. proton, neutron)
    """
    def __init__(self, color, anti=False):
        color = color.lower()
        if color not in ["blue", "red", "green"]:
            raise ValueError
        Strong.__init__(self, anti)
        ElectroWeak.__init__(self, anti)  # reverse charge if anti

class Up(Quark):
    mass = 2.4    # m  Mev/c2
    charge = 2/3  # Q

class Down(Quark):
    mass = 4.4
    charge = -1/3

class Charm(Quark):
    mass = 1320
    charge = 2/3

class Strange(Quark):
    mass = 87
    charge = -1/3

class Top(Quark):
    mass = 172700
    charge = 2/3

class Bottom(Quark):
    mass = 4240
    charge = -1/3

# Gauge Bosons
class W(Boson, ElectroWeak):
    mass = 80387
    charge = 1
    spin = 1

class Z(Boson, ElectroWeak):
    mass = 91187.6
    charge = 0
    spin = 1

class Photon(Boson, ElectroWeak):
    mass = 0
    charge = 0

class Gluon(Boson, Strong):
    spin = 1  # overrides attribute of Boson
    mass = 0
    charge = 0
    def __init__(self, color, anticolor):
        self.color = coler
        self.anticolor = anticolor

# Higgs Boson
class Higgs(Boson):
    spin = 2 # overrides attribute of Boson
    mass = 125000
    charge = 0

# Leptons  (6 + 6 anti = 12)
class Electron(Fermion, ElectroWeak):
    mass = 0.511
    charge = -1

class Tau(Fermion, ElectroWeak):
    mass = 1776.82
    charge = -1

class Muon(Fermion, ElectroWeak):
    mass = 105.7
    charge = -1

# masses are superpositional
class Neutrino_E(Electron):
    mass = .0022
    charge = 0

class Neutrino_T(Tau):
    mass = 0.17
    charge = 0

class Neutrino_M(Muon):
    mass = 15.5
    charge = 0

# Hadrons  (composed of 2 or 3 quarks, or "exotic" if more (not confirmed)

class Baryon(Fermion, Strong, ElectroWeak):
    pass

class Nucleon(Baryon):
    """Baryon -- one of two kinds of Hadron"""

class Proton(Nucleon):
    """
    Up("blue") + Up("red") + Down("green")
    Proton() + Electron() -> Neutron() + Neutrino_E()
    """
    mass = 938.27
    charge = 1

class Neutron(Nucleon):
    """
    Down("green") + Down("red") + Up("blue")
    Neutron() -> Proton() + Electron() + Neutrino_E(ANTI)
    """
    mass = 939.57
    charge = 0

class Sigma(Baryon):
    """
    Have two Ups or two Downs, and one something else (charm, strange,
bottom, top -- tops are too fast)
    """
    pass

class Omega(Baryon):
    """
    Have no Up or Down quarks
    """

class Lambda(Baryon):
    """
    One Up, One Down, and one something else
    """

class Xi(Baryon):
    """
    One up or down + two heavier quarks
    """

class Delta(Baryon):
    """
    up and down quarks only, spin 3/2 vs. nucleon 1/2
    Decay into nucleon + pion in short order
    """
    mass = 1232

class Meson(Boson, Strong, ElectroWeak):
    """ Meson -- the other kind of Hadron besides Baryon
    Unstable.  Charged -> electrons + neutrinos, Uncharged -> photons
    Flavorless (quarkonium):  quark + anti-quark of same type
    Flavorful:  quark + anti-quark of different type
    """

class D(Meson):
    """Flavorful with charm"""

class B(Meson):
    """Flavorful with charm"""

class Upsilon(Meson):
    """Flavorless with bottom (bottomonium, a form of quarkonium)"""
    mass = 9460
    spin = 1

class JPsi(Meson):
    """Flavorless with charm (excited charmonium)"""
    pass

class Pion(Meson):
    """
    Up() + Down(ANTI)  charge = 1 --> 99.9877%  Muon(ANTI) +
Neutrino_M(), .0123% Electron(ANTI) + Neutrino_E
    Up() + Up(ANTI) or Down() + Down(ANTI)  charge = 0
    Down() + Up(ANTI) charge = -1 --> 99.9877%  Muon() +
Neutrino_M(ANTI), .0123% Electron() + Neutrino_E(ANTI)
    """
    mass = 139.57 # if charged, else 135
    parity = -1

class Rho(Meson):
    mass = 770

class Phi(Meson):
    """
    Flavorless with strange
    """
    mass = 1019.4
    charge = 0  # 3 states

class Kaon(Meson):  #  K Mesons

    """
    Four types
    Flavorful:  Strange() + Up() or Down()
    """
    charge = 1
    mass = 493.7 if charge == (1 or -1) else 497.6

class Eta(Meson):
    charge = 0


More information about the Edu-sig mailing list