Skip to main content
Sandbox Physics
From quantum ripples to cosmic texture

Deriving the Mode Equation Behind a Computed Spectrum

To compute the primordial spectrum, the Lab integrates the inflaton background and then each mode from its initial vacuum state to a late readout. The background and mode equations below describe a canonical scalar field and Einstein gravity. An analytic benchmark and the Wronskian test different parts of the numerical calculation.

The background in e-fold time

Start from the Friedmann equation 3H2=12ϕ˙2+V3H^2=\tfrac12\dot\phi^2+V and the field equation ϕ¨+3Hϕ˙+V,ϕ=0\ddot\phi+3H\dot\phi+V_{,\phi}=0. Replace time derivatives with ϕ˙=Hϕ′\dot\phi=H\phi'.

The Friedmann equation becomes H2(3−12ϕ′2)=VH^2(3-\tfrac12\phi'^2)=V. With ϵ=12ϕ′2\epsilon=\tfrac12\phi'^2, which equals −H˙/H2-\dot H/H^2, this is the first formula below. Using H′/H=−ϵH'/H=-\epsilon in the field equation gives the second.

These two lines are the whole background. Inflation ends where ϵ=1\epsilon=1. Nothing here assumes slow roll; the field may lurch over a step and the equations still hold.

H2=V3−ϵ,ϕ′′=−(3−ϵ) ϕ′−V,ϕH2,ϵ=12ϕ′2H^{2}=\frac{V}{3-\epsilon},\qquad \phi''=-(3-\epsilon)\,\phi'-\frac{V_{,\phi}}{H^{2}},\qquad \epsilon=\tfrac12\phi'^{2}
Exact single-field background equations in e-fold time.

Reading: Ellis, Vennin & Wands, Review 23: Inflation, Review of Particle Physics (PDG 2025, revised August 2025) · Adams, Cresswell & Easther, Inflationary perturbations from a potential with a step (2001), astro-ph/0102236v2

The leading slow-roll estimate

When the motion is on the slow-roll attractor, ϕ′′\phi'' is small and ϵ≈ϵV=12(V,ϕ/V)2\epsilon\approx\epsilon_V=\tfrac12(V_{,\phi}/V)^2. The dashed reference uses the leading slow-roll power formula. The numeric background also uses a slow-roll starting velocity, with evolution governed by the background equations above.

Worked example on the R2R^2 plateau V=V0(1−e−2/3 ϕ)2V=V_0(1-e^{-\sqrt{2/3}\,\phi})^2. Where the pivot exits for N∗=55N_*=55, the integrator finds ϕ∗=5.3213\phi_*=5.3213. There e−2/3 ϕ∗=0.012974e^{-\sqrt{2/3}\,\phi_*}=0.012974, so V,ϕ/V=0.021464V_{,\phi}/V=0.021464 and ϵV=2.30×10−4\epsilon_V=2.30\times10^{-4}. The integrated background gives ϵ=2.28×10−4\epsilon=2.28\times10^{-4}, about one per cent lower.

Reading: Planck Collaboration, Planck 2018 results. X. Constraints on inflation, arXiv:1807.06211v2 · Original background and mode calculations with an independent Python reference

From the field to a wave equation

Expanding the action to second order in comoving gauge leaves the curvature perturbation R\mathcal{R} as the scalar degree of freedom. With v=zRv=z\mathcal{R} and z=aϕ′z=a\phi', the conformal-time equation is ∂τ2vk+[k2−(∂τ2z)/z]vk=0\partial_\tau^2 v_k+[k^2-(\partial_\tau^2 z)/z]v_k=0. The prime still denotes an e-fold derivative.

Rewritten in e-folds, it becomes the first equation below. The friction term is dln⁡(z2aH)/dNd\ln(z^2aH)/dN; this is the flux form of the previous chapter, expanded. Each tensor polarisation has the same structure with zz replaced by aa, so its friction is only 3−ϵ3-\epsilon.

A sharp step changes ϕ′′/ϕ′\phi''/\phi' rapidly. That changes the evolution of scalar modes that are still oscillating. They retain changes in phase and amplitude after the background settles, giving a range of alternating peaks and dips in the final spectrum.

R′′+(3−ϵ+2ϕ′′ϕ′)R′+(kaH)2R=0,h′′+(3−ϵ) h′+(kaH)2h=0\mathcal{R}''+\left(3-\epsilon+\frac{2\phi''}{\phi'}\right)\mathcal{R}'+\left(\frac{k}{aH}\right)^{2}\mathcal{R}=0,\qquad h''+(3-\epsilon)\,h'+\left(\frac{k}{aH}\right)^{2}h=0
Scalar and tensor mode equations in e-fold time. Both are linear, so every kk can be integrated on its own.

Reading: Maldacena, Non-Gaussian features of primordial fluctuations in single field inflationary models (2003), astro-ph/0210603v5 · Adams, Cresswell & Easther, Inflationary perturbations from a potential with a step (2001), astro-ph/0102236v2

Starting in the Bunch–Davies vacuum

Deep inside the Hubble scale, a Bunch–Davies mode approaches vk=e−ikτ/2kv_k=e^{-ik\tau}/\sqrt{2k}. The code starts near k/aH=100k/aH=100, using the de Sitter mode function below with the initial-time approximation τ≃−1/(aH)\tau\simeq-1/(aH) for the inflationary background.

Starting too late would add an error from the approximate initial state; starting earlier only costs time. The benchmark script checks this choice: against the exact power-law answer, the error stays below 2×10−62\times10^{-6} whether the start is k/aH=50k/aH=50, 100100 or 200200.

vk(τ)=e−ikτ2k(1−ikτ),Rk=vkzv_k(\tau)=\frac{e^{-ik\tau}}{\sqrt{2k}}\left(1-\frac{i}{k\tau}\right),\qquad \mathcal{R}_k=\frac{v_k}{z}
The de Sitter mode function used for the initial data; τ\tau is conformal time.

Reading: Adams, Cresswell & Easther, Inflationary perturbations from a potential with a step (2001), astro-ph/0102236v2 · 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

The Wronskian, a free accuracy check

Canonical quantisation requires v ∂τv∗−v∗∂τv=iv\,\partial_\tau v^*-v^*\partial_\tau v=i for all time. Since v=zRv=z\mathcal{R} and ∂τ=aH d/dN\partial_\tau=aH\,d/dN, this becomes the condition below. Exact solutions keep it; numerical errors break it.

In the Lab’s fixed-step integrator the drift falls with the step size as expected. For a power-law test, step factors 0.30.3, 0.150.15 and 0.0750.075 give Wronskian drifts of 1.1×10−31.1\times10^{-3}, 4.3×10−54.3\times10^{-5} and 5.5×10−65.5\times10^{-6}, beside power errors of 7.7×10−47.7\times10^{-4}, 4.4×10−54.4\times10^{-5} and 6.5×10−66.5\times10^{-6}. The two shrink together, so the drift is a usable warning light.

z2aH(R R∗′−R∗R′)=iz^{2}aH\left(\mathcal{R}\,\mathcal{R}^{*\prime}-\mathcal{R}^{*}\mathcal{R}'\right)=i
The Wronskian checks whether the integrator preserves canonical normalization. The exact-spectrum benchmark independently tests the final power.

Reading: Original background and mode calculations with an independent Python reference · Stewart & Lyth, A more accurate analytic calculation of the spectrum of cosmological perturbations produced during inflation (1993), gr-qc/9302019v1

Reading out the spectrum

We stop each mode at k/aH=10−3k/aH=10^{-3}, when it has frozen, and form the spectra below. The tensor factor 88 combines two polarisations with the 2/Mpl2/M_{\mathrm{pl}} normalisation of each.

The leading slow-roll estimate H2/(8π2ϵ)H^2/(8\pi^2\epsilon) at k=aHk=aH is the dashed curve. On the plateau it sits 2.5%2.5\% below the numerical result at the pivot; for 12m2ϕ2\tfrac12m^2\phi^2 the gap is 0.8%0.8\%. The leading formula drops terms of the order of the slow-roll parameters. On the plateau ∣ηV∣|\eta_V| is about 0.0170.017 while ϵ\epsilon is near 2×10−42\times10^{-4}, so a gap of a few per cent is the expected size.

PR=k3∣Rk∣22π2,Pt=8k3∣hk∣22π2,PR≈H28π2ϵ∣k=aH\mathcal{P}_{\mathcal{R}}=\frac{k^{3}|\mathcal{R}_k|^{2}}{2\pi^{2}},\qquad \mathcal{P}_{t}=\frac{8k^{3}|h_k|^{2}}{2\pi^{2}},\qquad \mathcal{P}_{\mathcal{R}}\approx\left.\frac{H^{2}}{8\pi^{2}\epsilon}\right|_{k=aH}
Numerical readout and the leading slow-roll estimate. In our variables hk=vk/ah_k=v_k/a for one polarisation.

Reading: Original background and mode calculations with an independent Python reference · Stewart & Lyth, A more accurate analytic calculation of the spectrum of cosmological perturbations produced during inflation (1993), gr-qc/9302019v1

Exercises and explained answers

  1. Check that v=e−ikτ/2kv=e^{-ik\tau}/\sqrt{2k} satisfies v ∂τv∗−v∗∂τv=iv\,\partial_\tau v^*-v^*\partial_\tau v=i.

    Read the explanation

    ∂τv∗=ik eikτ/2k\partial_\tau v^*=ik\,e^{ik\tau}/\sqrt{2k}, so v ∂τv∗=i/2v\,\partial_\tau v^*=i/2. Likewise v∗∂τv=−i/2v^*\partial_\tau v=-i/2. The difference is ii, independent of time.

  2. Derive H2=V/(3−ϵ)H^2=V/(3-\epsilon) and find the fraction of the total energy in field motion when ϵ=1\epsilon=1.

    Read the explanation

    Substitute ϕ˙=Hϕ′\dot\phi=H\phi' into the Friedmann equation to obtain 3H2=H2ϕ′2/2+V3H^2=H^2\phi'^2/2+V, or H2(3−ϵ)=VH^2(3-\epsilon)=V. At ϵ=1\epsilon=1, kinetic energy is H2H^2 out of a total 3H23H^2, so it accounts for one third. The acceleration is zero there.

  3. Why can the default step affect scalar modes more strongly than tensor modes, and what does the tensor-to-scalar ratio compare?

    Read the explanation

    The scalar friction contains 2ϕ′′/ϕ′2\phi''/\phi', which changes sharply at the step. Tensor friction contains only 3−ϵ3-\epsilon. The ratio compares both spectra, so changes in scalar power alone can move it. The two plateau models have nearly the same ratio at the pivot, while the default step changes it at k=0.002 Mpc−1k=0.002\,\mathrm{Mpc}^{-1}.

Try the prediction

Compare the full calculation with slow roll

  1. Choose Smooth plateau. Compare the solid spectrum with the dashed slow-roll reference at the pivot marker. The slow-roll curve is a few percent lower there.
  2. Choose Steep slope, strong gravitational waves. The gap shrinks, as the 0.8%0.8\% figure predicts.
  3. Choose Sharp step, exaggerated. Compare the broad sequence of peaks and dips in the solid spectrum with the local change in the dashed reference. The reference uses the background at crossing, while the full calculation follows the evolution before and after it.

Sources and calculation scope

  1. Planck Collaboration, Planck 2018 results. X. Constraints on inflation, arXiv:1807.06211v2

    Full v2 PDF (2 August 2019) read for Sections 4.2 and 7.1–7.3: equations 47–48, the step template in equations 57–62, Table 11 priors, Table 12 step results and Figure 28. The headline spectral index and amplitude quoted in this course come from its parameter tables.

  2. Ellis, Vennin & Wands, Review 23: Inflation, Review of Particle Physics (PDG 2025, revised August 2025)

    Full review read. Used: Section 23.3.4 equations 23.55–23.57 and its sentence on the ACT combination, Section 23.6 on reheating and the number of e-folds after the pivot exits, and Section 23.7.3.2 equations 23.101–23.103 for the sign convention of the local non-Gaussian amplitude and its single-field squeezed-limit value.

  3. Adams, Cresswell & Easther, Inflationary perturbations from a potential with a step (2001), astro-ph/0102236v2

    Full v2 read. Equation 1 defines the tanh step we use; equations 6–19 set out the mode equation in e-fold time and its initial data. Our code is written independently and puts the step on the Starobinsky plateau and on a quadratic potential, not only on the paper’s quadratic case.

  4. Maldacena, Non-Gaussian features of primordial fluctuations in single field inflationary models (2003), astro-ph/0210603v5

    Full v5 read. Equation 1.2 gives the squeezed-limit argument. In that paper the tilt symbol means the deviation from scale invariance, which modern papers write as the spectral index minus one.

  5. Stewart & Lyth, A more accurate analytic calculation of the spectrum of cosmological perturbations produced during inflation (1993), gr-qc/9302019v1

    Full v1 read, with printed pages 4–6 checked as images. Equations 31, 41 and 43 give the exact power-law-inflation spectra that our solver must reproduce.

  6. Original background and mode calculations with an independent Python reference

    Our own calculations: the Lab integrator and a separate NumPy/SciPy reference agree to better than three parts in ten thousand on all five presets. The ZIP holds the Python reference, closed-form benchmarks, five inputs and expected outputs. No Engine code and no paper text is included.

Keep reading

What this page links to directly

See this series on the content map →

From quantum ripples to cosmic texture · Reading path

Horizon exit, the mode equation and spectral constraints

  1. ArticleHow a Quantum Ripple Becomes Cosmic Structure
  2. ArticleWhy a Stretched Ripple Stops Changing After Horizon Exit
  3. You are hereDeriving the Mode Equation Behind a Computed Spectrum
  4. ArticleWhat the Tilt, Tensors and Squeezed Triangles Measure
  5. ArticleRecompute a Primordial Spectrum and Test the Solver
  6. ArticleReading Planck’s Searches for Inflation Features and Non-Gaussianity
Something broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy