Feynman Figures for Fun
In quantum physics, one of the calculations you might want to do is figure out how two or more particles may interact. This can become rather complicated and confusing once you get to more than two particles interacting, however. Also, depending on the interaction, there may be the creation and annihilation of virtual particles as part of the interaction. How can you keep all of this straight and figure out what could be happening? Enter the Feynman diagram (http://en.wikipedia.org/wiki/Feynman_diagram). American physicist Richard Feynman developed Feynman diagrams in 1948. They represent complex quantum particle interactions through a set of very simple diagrams, made up of straight lines, wavy lines and curly lines. This works really well if you happen to be using a chalk board or white board. But, these media are not very useful when sharing your ideas across the Internet. Additionally, most word-processing software is unable to draw these diagrams for your articles, papers and documents. So what can you do? Use the JaxoDraw software package (http://jaxodraw.sourceforge.net).
JaxoDraw provides a graphical environment for drawing Feynman diagrams on your computer. JaxoDraw is a Java application, so it should run on any OS that has a reasonably recent Java virtual machine. There currently are packages only for Fedora and Gentoo, but both source and binary downloads are available. The binary download is a jar file containing everything you need. There also are installers for Windows and a disk image for Mac OS X users. You also can download the source files and compile JaxoDraw for yourself or make alterations to the sources to add extra functionality. JaxoDraw supports a plugin architecture, with documentation on how to create your own. This might be a more effective way of adding any extra functionality you need.
Let's use the most flexible setup for JaxoDraw. This involves downloading a tarball from the main Web site, in the Downloads section. The filename you should see is jaxodraw-x.x-x-bin.tar.gz. Once this file is downloaded, you can unpack it with the command:
tar xvzf jaxodraw-x.x-x-bin.tar.gz
This will create a subdirectory containing the jar file and some documentation files. To start up JaxoDraw, first change to the new subdirectory and run:
java -jar jaxodraw-x.x-x.jar
Be aware that currently the GNU Java virtual machine doesn't run JaxoDraw. On start up, you will have an empty canvas and a list of the elements available to draw your Feynman diagram (Figure 1). The left-hand side is broken into several sections, including the types of particles or the types of edits available. JaxoDraw uses XML files to save Feynman diagrams. This way, you can load them again later to make edits or build up more-complicated reactions.
Figure 1. JaxoDraw on Startup
To begin drawing, first select an object type from the left-hand side. The regular particle types are fermions (straight lines), scalars (dashed lines), ghost (dotted lines), photons (wiggly lines) and gluons (pig-tailed lines). In the diagrams, there are four versions of these particle lines: lines, arcs, loops and beziers. Once you select one of those, you can draw on the canvas by clicking and dragging to draw the relevant line. You can draw anywhere on the canvas, or you can force the drawing to snap to grid points. The spacing of these grid points is adjustable in the Preferences. At least in the beginning, you probably will want to turn this on so that you can make the different sections of your drawing line up. Each of the elements of your drawing has properties that can be edited. You need to select the edit tool from the left-hand side, and then select the element you want to edit (Figure 2).
Figure 2. Edit Options
From here, you can edit the location, whether there is an arrow and which direction it points, the line width and arrow dimensions. There is also a text element you can use to label your diagram. You can enter text in either LaTeX format or PostScript format. This allows you to use special characters, such Greek letters, in your text label. One thing to remember is that you can't mix PostScript and LaTeX text objects. Be sure to select the text type based on what you want to produce for exported output.
You can group a number of diagram elements together in a single entity. You need to press the selection tool on the left-hand side and then click on each of the entities for the group you are creating. This grouped entity then can be moved as a single object. You can group together these groups into super groups. There is no technical limit to this type of nesting.
You can get a rough idea of what your Feynman diagram will look like, but things like LaTeX text aren't rendered on the drawing canvas. You need to pass it through a rendering program and then view the output. You will need to go to Options→Preferences and set the paths for the helper programs. To get a preview of your finished diagram, be sure to set the preferred PostScript viewer, the LaTeX path and the dvips path. A common PostScript viewer is gv, the viewer that comes with ghostscript.
Once you have finished your diagram, save it as a JaxoDraw XML file. This way, you always can go back and re-create the diagram if needed.
You can export your Feynman diagram in one of several formats. You can export into image files (JPEG and PNG). This is useful if you are using PowerPoint or Web pages or some other software package that doesn't understand LaTeX or PostScript. You also have the option to export into LaTeX or PostScript file formats. If you export to LaTeX, you need to include the JaxoDraw LaTeX style file to handle the rendering of your Feynman diagram. This style file is called axodraw4j.sty, which is based on J. Vermaseren's original axodraw.sty (http://www.nikhef.nl/~form/maindir/others/axodraw/axodraw.html). This is now a separate download from the main JaxoDraw application download. You will want to install this where your LaTeX installation can find it and use it. The easiest thing to do is copy it into the same directory as your LaTeX document source files. LaTeX searches there by default when you render your LaTeX documents. axodraw4j.sty is still in beta, so you may want to stick with the original axodraw package. This package also is needed if you want to preview your diagram in JaxoDraw.
Now that I've covered some of JaxoDraw's features, let's look at drawing one of the classic particle interactions. This is where an electron and a positron collide, producing photons. The first step is to draw two fermions, with arrows pointing in opposite directions (Figure 3). In these diagrams, space is in the vertical direction, and time is in the horizontal direction. Time increases from left to right. The electron and positron collide and annihilate, producing at least one photon (Figure 4).
Figure 3. Electron/Positron Collision
Figure 4. Producing a Photon
At the time of this writing, four plugins are available. These are different export functions. Two of them are for exporting to PDF or SVG file formats. The third one is to serialize your diagram in the Java binary file serialization format. This format should be functionally equivalent to the XML file format, but it is smaller and loads faster, especially for larger diagrams. The only problem with it is that it is a binary file format, so you can't take a look inside it. The last plugin is just a text exporter. It provides a template to show you what a simple custom exporter looks like.
JaxoDraw has a plugin manager to handle installing and uninstalling plugins (Figure 5). You simply have to download the relevant jar file, then use the plugin manager to install it. Plugins are stored at $HOME/.jaxodraw/$VERSION/plugins. If you like, you can install plugins manually by dropping the associated jar file into this directory. To uninstall manually, you can delete the relevant jar file and any corresponding property files from this location.
Figure 5. Plugin Manager
With the possible sighting of the Higgs boson at the LHC, interest in particle physics is growing. Now, with JaxoDraw, you too can write about particle interactions and be able to draw a proper picture to show others what you are trying to describe. Have fun, and share your insights with others.
Joey Bernard has a background in both physics and computer science. This serves him well in his day job as a computational research consultant at the University of New Brunswick. He also teaches computational physics and parallel programming.
- Is the Private Cloud a Real Cloud?
- Open Axiom
- Give new life to old phones and tablets with these tips!
- Readers' Choice Awards 2014 Poll
- Tech Tip: Really Simple HTTP Server with Python
- Memory Ordering in Modern Microprocessors, Part I
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep