demoAINuclear physics
The two-pion loop function, built and differentiated by a small computer algebra system
The loop function sets the momentum dependence of the two-pion-exchange nuclear force at next-to-leading order. The program writes it as an expression tape, evaluates it, and differentiates the tape symbolically into a second tape. Both are checked against a 30-digit Feynman-parameter integral that never uses the closed form: and /MeV there, to and /MeV.
Open in the workbenchDownload .vivOutputs below are from the site build’s run; Run all runs it again in your browser.
Look inside this program
- Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
In chiral effective field theory the force between two nucleons is a sum of pion exchanges and short-range contact terms. At next-to-leading order the exchange of two pions enters through one function of the momentum transfer ,
which multiplies the central, tensor and spin-spin parts of the potential (Machleidt and Entem, Phys. Rep. 503, 1 (2011), Eqs. (4.9)-(4.12), with their average pion mass MeV). , and grows like at large . As a function of it has a branch cut that starts at , the two-pion threshold, so in coordinate space the force it carries has range , half the one-pion range.
Higher orders need many such functions and their derivatives, which is the job of a computer algebra system. This post builds a small one: an expression tape, a list of operations each of which refers to earlier entries, with an evaluator and a differentiator that turns a tape into the tape of its derivative.
The reference, posts/refs/the-pion-loop-function-by-computer-algebra.py,
does not use the closed form. It computes the loop from its
Feynman-parameter integral (the equation under the title) with mpmath's
quadrature at 30 digits, and the derivative by mpmath's numerical
differentiation of that integral.
The tape of
The program writes the way it is printed: as the square root of , then . That is 11 entries. Differentiating appends the derivative of every entry, including the derivatives of constants, which are zero; the tape grows to 36 entries. Nothing simplifies the result, so the derivative tape does more arithmetic than a hand-written derivative would, but it is exact.
Printed
Tests 1 of 1 pass
- the tape of L has 11 entries, and 36 once differentiated (passes)
Values against the Feynman-parameter integral
The reference evaluates at eight momenta from its integral representation, which comes from the loop diagram itself, not from the closed form. The tape agrees at every one to , from MeV, where , to 1 GeV. At small the logarithm in the integral expands, and with and , ,
At MeV, , and the tape matches the two terms to .
A third representation is the dispersion integral: has an imaginary part above the two-pion threshold , and
The program maps to with and integrates by Simpson's rule on 2000 intervals. The integrand has a square-root zero at threshold, where Simpson's rule loses its order, and the result is off by at MeV.
Printed
Tests 6 of 6 pass
- the tape matches the Feynman-parameter integral at all eight momenta to 1e-14 (passes)
- at q = 1 MeV it is 1 + t/12 - t^2/120, t = q^2/m_pi^2, to 1e-13 (passes)
- the dispersion integral by Simpson's rule gives L(200) to 1e-6 (passes)
- the dispersion integral is off by 4.4e-7 at q = 200 MeV (passes)
- at q = 1 MeV, L - 1 is 4.4e-6 and t^2/120 is 2.3e-11 (passes)
- the integrals of x(1 - x) and x^2 (1 - x)^2 over [0, 1] are 1/6 and 1/30 (passes)
The derivative
The derivative tape, evaluated at three momenta, matches mpmath's numerical derivative of the Feynman-parameter integral to per MeV, rounding in a number of about 0.001. A central difference on the tape with a step of 1 MeV is off by up to , which is the error of that step; the symbolic derivative has no step to choose.
Printed
Tests 4 of 4 pass
- the symbolic derivative matches mpmath's derivative of the integral to 1e-15 per MeV (passes)
- the derivative tape is within 2e-17 per MeV of mpmath at all three momenta (passes)
- the central difference is off by up to 5.3e-9 (passes)
- a central difference with a 1 MeV step is off by 2e-10 to 6e-9 (passes)