Your first diagram¶
feynjs turns a few lines of text into a Feynman diagram, drawn as SVG. To draw these yourself, put
them in a feynman block on a Zensical site or in an Obsidian note,
or paste them into the playground. To install feynjs for your own code, see
Install.
Early days
feynjs is at version 0.9. The syntax described here is stable enough to write diagrams with, but details of the layout still change from release to release.
A first diagram¶
An electron and a positron annihilate into a photon, which makes a muon pair, as drawn at the top of this page:
Read it line by line:
i1 [e-] -- a -- i2 [e+]is a chain. It joins three vertices,i1,aandi2, with two lines.i1andi2are external legs. Names starting withicome in from the left, so these two are the incoming particles.[e-]and[e+]say which particles they are.a -- [gamma] bjoins the two interaction points with a photon.[gamma]sets the wavy line and the label γ.f1 [mu-] -- b -- f2 [mu+]gives the outgoing muons. Names starting withfleave to the right.
You never said where anything goes, which way the arrows point, or which line is wavy. The particle names decided the styles and labels. The arrows follow the fermion flow: the positron's arrow points backwards, as it does in a paper. The layout found the s-channel shape.
Change it¶
Swap the photon for a Z and the muons for neutrinos:
Exchange the photon in the t-channel instead: each electron line runs straight through.
Add a gluon loop, a Higgs, a cascade of decays: the components cover each one.
When something is wrong¶
A mistake in the text gives a message with its line number instead of a diagram:
feynjs.check(source) (or feynjs check diagram.feyn) finds physics slips the drawing would
hide: fermion lines that don't pair up at a vertex, arrows that don't flow through, legs with no
particle name. See Checking diagrams.
Next¶
- Write edges, as in TikZ-Feynman: the full syntax, step by step.
- Write processes, as in MadGraph: name the process and its decays.
- Examples: hundreds of diagrams with their source.