Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Scientific Software for QFT

    Choose software for a specified calculation and keep its conventions visible. A useful result consists of the expression or number and the assumptions, parameter definitions and reproducible inputs that produced it.

    Match the tool to the calculation

    TaskTool and principal check
    Exact scalar or matrix algebraSymPy: use exact rationals and explicit assumptions; compare a small identity by hand.
    Numerical integration and linear algebraSciPy: inspect algorithm conditions and error estimates; vary resolution or tolerances and compare a benchmark.
    Dirac, color and perturbative algebraFeynCalc: match the metric, dimension, trace and γ5\gamma_5 prescription before importing an amplitude.
    Dimensionally regulated parametric integralspySecDec: match loop measures, regulator dimension and prefactors as well as kinematics.
    Model-based scattering generationMadGraph model tools: verify the chosen model, parameter restrictions, perturbative order and process definition.

    A loop integral normalized with dDk/(iπD/2)\mathrm d^Dk/(i\pi^{D/2}) differs from one normalized with dDk/(2π)D\mathrm d^Dk/(2\pi)^D. A package name is not a convention specification. See dimensional integrals before comparing finite coefficients.

    Benchmark a subtracted loop integral

    A program can return the correct precision for an integral and still lose most of it when two results are subtracted. A useful test is the equal-mass scalar bubble at spacelike momentum. With t=Q2/m2>0t=Q^2/m^2>0, the finite difference in the one-loop convention is B(−Q2)−B(0)=−F(t)/(16π2)B(-Q^2)-B(0)=-F(t)/(16\pi^2), where

    F(t)=∫01log⁡ ⁣[1+t x(1−x)] dx.F(t)=\int_0^1\log\!\left[1+t\,x(1-x)\right]\,dx .

    Two reference values follow without any choice of loop regulator. The substitution x=(1+y)/2x=(1+y)/2 and integration by parts give F=2[a artanh⁡(1/a)−1]F=2[a\,\operatorname{artanh}(1/a)-1], with a=1+4/ta=\sqrt{1+4/t}. Expanding the logarithm under the integral gives F=t/6−t2/60+O(t3)F=t/6-t^2/60+O(t^3). The positive leading term means that the subtracted spacelike bubble is negative in the stated convention.

    from math import atanh, log1p, sqrt
    from scipy.integrate import quad
    
    for t in (1.0, 1e-12):
        a = sqrt(1 + 4/t)
        closed = 2 * (a * atanh(1/a) - 1)
        direct, error = quad(lambda x: log1p(t*x*(1-x)), 0, 1,
                             epsabs=0, epsrel=1e-12)
        print(t, closed, direct, direct/t)
    

    At t=1t=1 both forms give 0.152044704820…0.152044704820\ldots. At t=10−12t=10^{-12}, the ratio F(t)/tF(t)/t should approach 1/61/6. The quadrature with log1p gives 0.166666666666650.16666666666665 on the checked run. The closed form subtracts two numbers near one and had a relative error of about 1.9×10−31.9\times10^{-3} in that run. Estimate the loss by comparing with the series at the same tt. The quadrature error estimate covers the integral supplied to the program. SciPy quadrature options · Loop integral and threshold derivation.

    For symbolic work, keep rationals exact and state parameter domains before simplification. The handbook example uses a>0a>0 in an exponential integral. In SymPy, Rational(1, 3) preserves an exact third. SymPy exact numbers and assumptions.

    Preserve the physical and numerical problem

    A small useful record includes the program and package versions, input parameters with units, gauge and regulator choices, random seed when relevant, precision and tolerances, and the script or notebook that generates the selected output. For Monte Carlo data also retain sampling and autocorrelation information; a seed does not determine the statistical error by itself.

    Check a physical identity before scaling up: current conservation for an amplitude, a free spectrum for a lattice operator, a known integral for quadrature, or probability conservation for time evolution. Then vary the numerical control independently of physical approximations. Increasing arithmetic precision does not remove a finite-volume effect or repair an incorrect operator basis.

    Use the package authors' installation and citation instructions for the version selected. For the scientific error analysis continue to numerical convergence and Monte Carlo errors.

    Documentation

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.