Test the solver on an exact answer first
Power-law inflation, V=V0e−λϕ, has constant ϵ=λ2/2, and its scalar and tensor spectra are known in closed form from Stewart and Lyth’s equations 31, 41 and 43. The benchmark compares the numerical spectra with that formula, not with the slow-roll estimate.
Our run covered λ from 0.02 to 0.3. The worst power error was 2.0×10−6 and the worst Wronskian drift 4.0×10−7. The leading slow-roll formula was off by 1.1×10−4 at ϵ=2×10−4 and by 2.6% at ϵ=0.045. That is why the closed form, not slow roll, is the test.
The script exits with an error if any check fails. Move on once it passes on your machine.
python verify_benchmarks.py my-benchmarks.json
Reading: Stewart & Lyth, A more accurate analytic calculation of the spectrum of cosmological perturbations produced during inflation (1993), gr-qc/9302019v1 · Original background and mode calculations with an independent Python reference
Recompute a fixed model
Each input names the potential, the amplitude V0 in units of Mpl4, the starting field, N∗, the step and a grid of 27 wavenumbers in Mpc−1. The step uses the tanh form of Adams, Cresswell and Easther’s equation 1, with its position and width given in field units.
The output holds the background, with total e-folds, pivot field and ϵ there, then one row per wavenumber. Each row gives the scalar and tensor power, the slow-roll estimate, the exit time and the field at exit. Each preset takes about one second.
On the same software versions our fresh run matched the expected file exactly. A different SciPy may move the last digits; the comparison script fails above 10−4, which is far larger than the solver error and far smaller than any physical effect discussed here.
python recompute_inflation_spectrum.py inputs/step-ripples.json my-step.json
python compare_with_expected.py my-step.json expected/step-ripples.json
Reading: Adams, Cresswell & Easther, Inflationary perturbations from a potential with a step (2001), astro-ph/0102236v2 · Original background and mode calculations with an independent Python reference
Measure the tilt and tensor ratio yourself
Make a three-point input around the pivot and difference the logarithm of the power. The snippet below does it for the plateau.
Our results: plateau ns=0.96490, r=0.00355; with the default step, the same to four decimal places; quadratic ns=0.96338, r=0.14403; shorter reheating, N∗=46, ns=0.95826, r=0.00498.
The amplitude needs care. The plateau’s V0 was chosen so that As=2.0989×10−9, matching Planck’s ln(1010As)=3.044. With the same V0 the N∗=46 model gives 1.4880×10−9. Since PR∝V0 at fixed N∗, rescaling V0 by 1.4105 restores it without changing the tilt or r.
import json, math, subprocess
model = json.load(open('inputs/smooth-plateau.json'))
model['kGridMpc'] = [0.049, 0.05, 0.051]
json.dump(model, open('tilt-input.json', 'w'))
subprocess.run(['python', 'recompute_inflation_spectrum.py', 'tilt-input.json', 'tilt-output.json'], check=True)
low, mid, high = json.load(open('tilt-output.json'))['spectrum']
print('n_s =', 1 + math.log(high['scalar'] / low['scalar']) / math.log(0.051 / 0.049))
print('r =', mid['tensor'] / mid['scalar'])
Reading: Original background and mode calculations with an independent Python reference · Planck Collaboration, Planck 2018 results. X. Constraints on inflation, arXiv:1807.06211v2
Failure cases we actually hit
Absolute tolerance. An early version used a fixed atol=10−30. For N∗=46 the starting ∣R∣ ranges from about 2×10−29 to 10−24 across the grid in these units, so the tolerance was loose. Over the 27-point grid the power came out up to 0.55% wrong and the Wronskian drifted by up to 0.88%, while the integrator reported success. The plateau at N∗=55 stayed below 10−4. The fix scales the tolerance to each component’s starting size.
Step position. With the step crossed 58 e-folds before the end, its ringing reached the pivot and moved the reported tilt. We moved the default step to 59 e-folds and now check the pivot tilt against the smooth model.
Pivot choice for r. The default step leaves r at 0.05Mpc−1 unchanged, at 0.00355, but raises it at 0.002Mpc−1 from 0.00318 to 0.00441. The Lab therefore reports r at 0.05Mpc−1.
Reading: Original background and mode calculations with an independent Python reference · Planck Collaboration, Planck 2018 results. X. Constraints on inflation, arXiv:1807.06211v2