Package-X is hosted by Hepforge, IPPP Durham

Hiren H. Patel


Package-X is a Mathematica package to obtain analytic expressions for one-loop integrals in higher order calculations of relativistic quantum field theory in 4 spacetime dimensions.

               Technical features
  • Computes dimensionally regulated one-loop integrals with up to four distinct propagators of arbitrarily high rank.
  • Calculates traces of Dirac matrices in d dimensions for closed fermion loops, or carries out Dirac algebra for open fermion lines
  • Generates analytic results for any kinematic configuration (e.g. at zero external momentum, at physical threshold, etc.) for real masses and external invariants.
  • Provides analytic expressions for UV-divergent, IR-divergent and finite parts either separately or all together.
  • Constructs Taylor series expansions for one-loop integrals
  • Evaluates with either machine precision or arbitrary precision arithmetic, and is always consistent with the + prescription
               User interface features
  • Complete documentation available within the Wolfram Documentation Center which includes
    • over 300 basic usage examples with detailed information for every symbol defined by Package-X,
    • 3 project-scale tutorials,
    • and instructions on linking Package-X to FeynCalc and LoopTools.
  • Readable and intuitive input (see Featured code snippets below)
  • Output easily manipulatable and readily numerically evaluatable

Featured code snippets

Compute the transverse part of the QED vacuum polarization tensor:
Its series expansion near q2 = 0:
Compute the QED vertex function:
Compute the UV-divergent part of the QCD vacuum polarization function in general covariant Rξ gauges:
Compute the massless one loop scalar four-point integral in 6 dimensions:

Reference and Source

Package-X was developed after several long years of tedious work. Please include the following citation if Package-X was useful for your publication.
    Hiren H. Patel, Comput. Phys. Commun. 197, 276 (2015),
    ePrint: arXiv:1503.01469

Esentially all algorithms and formulae used by Package-X can be viewed in handwritten form at (Vol II, §1 and §5, and Vol V).


Package-X is closed source and distributed under the standard CPC license agreement.
Package-X 2.0 is closed source and distributed under the CC by 4.0 license.

Bug report and feature request

Please report any bugs to Any comments and suggestions for improvements, including feature requests, are welcome.

Latest release

v2.0.4 second release: (May 18, 2017) Download
  • Fixed a bug causing ScalarD0 to return 1/0 errors or incorrect values when an external invariant was evaluated on threshold with nonvanishing internal masses.
  • Fixed a bug causing D0Expand to incorrectly convert ScalarD0 when an external invariant was on threshold with nonvanishing internal masses.
  • Fixed a bug affecting LoopRefine and LoopRefineSeries causing it to incorrectly convert (n ≠ 4)-dimensional, weighted, or differentiated PVD functions to analytic expressions (thanks, Mirko Serino). Normal forms of PVD functions were unaffected.
  • TraditionalForms of PVA, PVB, PVC, and PVD are now typeset in boldface to emphasize their full dependence on number of dimensions d, and to distinguish them from ScalarC0 and ScalarD0 (which are defined in 4 dimensions).
  • MandelstamRelations now includes the rule ε{p1},{p2},{p3},{p4}->0 among the list of rules in its output.
  • The underlying code for FermionLineExpand to process FermionLineProduct objects has been modified.
  • Updated documentation pages for compatibility with the style featured in Mathematica 11.1 and above.
  • Expanded tutorial "Scattering of Light by Light" accessed from the guide page.
  • Completed tutorial "Ward identities and γ5 in Dimensional Regularization" accessed from the guide page.
v2.0.3 second release: (December 14, 2016) Download
  • Fixed a bug where Series would occasionally incorrectly expand DiscB at zero external momentum (thanks, Camilo Garcia Cely).
  • Fixed a bug where LoopRefineSeries would not convert its input to analytic expressions when the input was independent of the expansion parameter (thanks, Prasenjit Sanyal).
  • Fixed a bug that caused General::optb error messages to be generated at initialization in earlier versions of Mathematica (thanks, Prasenjit Sanyal).
  • Longitudinal and Transverse no longer have HoldFirst attribute, since it used to interfere with simplification routines of other tensor algebraic functions like LoopIntegrate and Contract.
  • FermionLineExpand and LoopIntegrate now correctly applies Sirlin identities to FermionLineProduct involving massive spinors (thanks, Matteo Fael).
v2.0.2: (November 23, 2016) Download
  • FermionLineExpand no longer avoids applying spinor equations of motion when downvalues to scalar products are assigned.
  • Addressed an issue that caused major performance slowdown on large expressions involving FermionLine objects.
  • FermionLineExpand more completely simplifies FermionLineProduct objects.
  • Added option DiracAlgebra to FermionLineExpand.
  • Off shell fermion self energy form factor C(p2) has been redefined without a factor of i in front (affects Projector only).
  • LoopRefine no longer gives 1/0 errors when Part->IRDivergent is set.
  • Fixed typos in documentation.
v2.0.1: (October 25, 2016) Download
  • Fixed a bug where FermionLineExpand and other tensor manipulation routines would drop the quadruply contracted Levi-Civita symbol (thanks, Matthew Kirk).
  • Fixed a bug where FermionLineProduct would fail to automatically expand over deeply nested sums over FermionLine objects.
  • Fixed a bug where on rare occasions Series would incorrectly expand DiscB around normal threshold.
v2.0.0: (October 14, 2016) Download


Get started with the tutorial (October 14, 2016).


Any computer running Mathematica
Minimum: Mathematica 8.0.4 or higher.
Recommended: Mathematica 10.1.0 or higher.

Note A bug was introduced in Mathematica 10.4.0 and 10.4.1 causing the numerical evaluation of Package-X special functions compiled to the Wolfram Virtual Machine (e.g. ScalarC0, ScalarD0, ...) to take an excessive amount of time.

Installation Instructions

Uncompress downloaded file, and copy the Package-X folder (/X) with all its contents to the folder $UserBaseDirectory/Applications/. See the tutorial for details.

Backwards compatibility

The following changes from v1.0.4 to v2.0.0 may affect existing notebooks that were created with Package-X v1.0:
  • Passarino-Veltman functions pvA, pvB, pvC, pvC0, and pvC0IR6 are now named PVA, PVB, PVC, ScalarC0, and ScalarC0IR6, respectively, consistent with the naming convention of capitalizing the first letter of pre-defined symbols.
  • LoopIntegrate now normalizes its integration measure so that e-γ ϵ is factored out instead of rΓ. This is to prepare Package-X for computing two loop integrals in the future. This only changes the output of LoopRefine for integrals exhibiting 1/ϵ2 poles, arising from overlapping soft and collinear divergences, by an amount proportional to ~π2/12 to the finite part.
  • Order of arguments of PVC (was pvC) and ScalarC0 (was pvC0) has been changed to match that of FeynCalc, LoopTools, and essentially all other authors in the literature (Sorry to v1.0 users who struggled to match against literature!). The relations are PVC[r,n1,n2,s1,s12,s2,m0,m1,m2] = pvC[r,n1,n2,s1,s2,s12,m2,m1,m0] and ScalarC0[s1,s12,s2,m0,m1,m2] = pvC0[s1,s2,s12,m2,m1,m0]
  • ScalarC0 is now a function defined manifestly in four dimensions, and will return ComplexInfinity for cases that are IR divergent. The related function PVC[0,0,0, args] lives in d dimensions, and will yield 1/ϵ poles by LoopRefine for IR divergent cases.
  • Package contexts X`IndexAlg`, X`Spur`, and X`OneLoop` are deprecated; all package symbols now belong to a common context X`
  • Auxiliary Passarino-Veltman function pvb is now obsolete, and is covered by higher weight PVB functions.
  • Dimensional regularization ('t Hooft) scale μR is now denoted with µ (\[Micro]), and entered with the keyboard alias [esc][m][m][esc].
  • As of v2.0.2, off shell fermion self energy form factor C(p2) has been redefined without a factor of i in front (affects results obtained by Projector only).
LoopIntegrate generates capitalized PVA...PVD, and the three-point functions PVC and ScalarC0 are generated with the updated ordering for their arguments. LoopRefine generates expressions with µ denoting the dimensional regularization scale, and with the updated normalization affecting integrals with overlapping soft and collinear IR divergences. Since legacy syntax of LoopIntegrate is still possible and the syntax of LoopRefine is unchanged, rerunning code with v2.0 in notebooks that used v1.0 should update expressions reflecting the changes. You may download v1.0.4 here, but it is no longer supported.