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 prints the scalar and tensor errors, Wronskian drift, and rows for the start-ratio and tolerance changes. Its exit status checks the worst scalar error and Wronskian drift for rows with rtol≤10−10. Read the tensor error and the looser-tolerance row separately.
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, its normalization, the starting field, N∗, the step and a grid of 27 wavenumbers in Mpc−1. The plateau uses a height V0 in units of Mpl4. The quadratic input instead uses a mass squared in units of Mpl2. The tanh step’s position and width are 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.
The archived run reproduces exactly with the pinned software. The comparison script checks that the wavenumber grids match and that the scalar and tensor powers agree to within a relative tolerance of 10−4. A pass checks those fields at the saved wavenumbers.
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
Run this snippet as Python from the same folder, with the virtual environment active. It writes a separate three-point input, runs the solver and differences the log powers around the pivot.
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
Three checks that caught numerical and comparison errors
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 setting at 58 e-folds before the end, ringing shifts the modeled tilt at the pivot. The default 59 e-folds keeps the tilt close to the smooth model for this preset.
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