<<

Cosmological perturbations without the Boltzmann hierarchy

Marc Kamionkowski Department of and Astronomy, , 3400 N. Charles St., Baltimore, MD 21218 (Dated: May 10, 2021) Calculations of the evolution of cosmological perturbations generally involve solution of a large number of coupled differential equations to describe the evolution of the multipole moments of the distribution of photon intensities and polarization. However, this “Boltzmann hierarchy” commu- nicates with the rest of the system of equations for the other perturbation variables only through the photon-intensity quadrupole moment. Here I develop an alternative formulation wherein this photon-intensity quadrupole is obtained via solution of two coupled integral equations—one for the intensity quadrupole and another for the linear-polarization quadrupole—rather than the full Boltzmann hierarchy. This alternative method of calculation provides some physical insight and a cross-check for the traditional approach. I describe a simple and efficient iterative numerical solution that converges fairly quickly. I surmise that this may allow current state-of-the-art cosmological- perturbation codes to be accelerated.

PACS numbers:

I. INTRODUCTION provide new insights into the physics and may perhaps provide tools that can be applied to other problems. Linear-theory calculations of the evolution of primor- It was realized that for primordial tensor perturbations dial density perturbations provide the foundation for (i.e., gravitational waves), the Boltzmann hierarchy can the interpretation of cosmic microwave background and be replaced by a small set of integral equations (IEs) large-scale-structure measurements. They are thus an [7, 8], an approach used in Refs. [9, 10] A similar ap- essential tool in the construction of our current cosmo- proach was discussed for scalar perturbations (primordial logical model and in the continuing quest for new cosmo- density perturbations) in Ref. [11], but not implemented logical physics. numerically. The calculations, which trace back over 50 years Here, I re-visit this integral-equation approach for pri- [1], involve time evolution of a set of coupled differ- mordial density perturbations. I discuss simplifications ential equations [2] for the metric perturbations and to the equations in Ref. [11] and describe a specific im- for the dark-matter, baryon, neutrino, and photon den- plementation where the Boltzmann hierarchy for all pho- sity and velocity perturbations. There is also a (nomi- ton intensity/polarization multipole moments from the nally infinite) “Boltzmann hierarchy” of differential equa- quadrupole (l = 2) and higher are replaced by two IEs, tions for the higher moments (quadrupole, octupole, one for the photon quadrupole, and another for the po- etc.) of the photon-intensity and photon-polarization larization quadrupole. I discuss the numerical solution and neutrino-momentum distributions. The photon hi- of these integral equations and how the initial conditions erarchies can be truncated at some maximum multi- for the IEs are set from an early-time solution obtained pole moment lmax ' 30 to provide sufficient precision with the TCA. I describe an iterative algorithm to solve for the monopole, dipole, and octupole from which the these integral equations simultaneously with the differ- higher-order moments (which provide the CMB tem- ential equations for the other perturbation variables. I perature/polarization power spectra) can be obtained show results from two simple numerical codes that are through a line-of-sight integral [3]. Higher-order exten- identical except for the replacement of the Boltzmann hi- sions to the tight-coupling approximation (TCA) [4, 5], erarchy in the first with the two integral equations in the improved numerical integrators, and novel approxima- second. Numerical experiments with these codes suggest that this iterative IE algorithm may, with further work,

arXiv:2105.02887v1 [astro-ph.CO] 6 May 2021 tions to free-streaming relativistic particles [5]) have pro- vided incredible code acceleration to what is still a fairly allow current state-of-the-art codes to be accelerated. complicated numerical calculation. At present, virtually This paper is organized as follows. Section II, presents all work in cosmology now relies on two publicly available and discusses the integral equations. Section III pro- codes, CAMB [6] and CLASS [5], which combine speed and vides the differential equations for the other perturbation precision with model flexibility. variables (i.e., for neutrinos, , baryons, and These codes are now extremely efficient and reliable. the metric) and describe how the two integral equations However, modern cosmological analyses, which employ are combined with these other equations. Section IV Markov chain Monte Carlos to map the likelihood in a describes a simple algorithm to solve the integral equa- multi-dimensional parameter space, require these codes tions numerically and how the initial conditions for the to be run repeatedly, thus employing signficant compu- IE solver are obtained from the tight-coupling approx- tational resources. It is thus worthwhile to explore new imation at early times. This Section also describes an numerical approaches. New approaches can also often iterative algorithm to solve them in tandem with the dif- 2

LL 1 00 ferential equations. Section VI describes the two rudi- Also, Rl (x) = − 2 [jl(x) + 3jl (x)] [12, 13] in terms of mentary codes to evolve the Boltzmann hierarchy and the spherical Bessel functions jl(x), and θbk(τ) is the baryon IE equations. I then present and discuss results of the velocity. It is related to the photon velocity (suppressing calculation. Section VII concludes with a discussion of hereafter the subscript k for notational economy) θγ (τ) = T possible concerns and ideas for further steps. Appendix A 3k∆k1(τ) through provides the photon Boltzmann equations in the notation used here, and Appendix B provides details of the algo- ˙ 2 2 κ˙ θb = −Hθb + csk δb + (θγ − θb), (4) rithm to solve the integral equation. The codes are pro- R vided at https://github.com/marckamion/IE for read- where H(τ) ≡ a/a˙ and R(τ) ≡ (3/4)ρb(τ)/ργ (τ), the ers interested to follow up on calculational details that scale factor in units of 3/4 of that at matter-baryon equal- cannot be inferred from the presentation here. ity (ρb(τ) and ργ (τ) are mean baryon and photon energy densities, respectively). The baryon sound speed cs is in- creasingly important on small scales but has little effect II. FORMALISM on the larger distance/angular scales relevant for CMB fluctuations. Here, h(τ) is the standard synchronous- If we have a spectrum of initial curvature fluctuations gauge perturbation variable, and α(τ) = h(τ) + 6η(τ) in 2 with power spectrum PR(k) = |R~k| , then the CMB terms of the commonly used synchronous-gauge variable temperature/polarization power spectra are η(τ). Z The function Π(τ) is a linear combination of the XX0 2 −1 2 X X0 Cl = (2π ) k dk PR(k)∆kl(τ0)∆kl (τ0), (1) photon-intensity and polarization quadrupoles; for sim- plicity, I refer to it here as the polarization quadrupole. for X,X’=T,E with “T” the temperature and “E” the E- It can also be written as an IE, mode of the polarization. The transfer functions ∆X (τ) kl T are obtained through solution of differential equations Π(τ) = ∆2 (τ) + 9E2(τ), (5) for the time evolution of the relativistic gravitational po- with tentials, the baryon, dark-matter, photon, and neutrino Z τ 0 densities and bulk velocities, and the higher moments of 0 0 jl(k(τ − τ )) 0 El(τ) = dτ g(τ, τ ) Π(τ ). (6) the photon and neutrino momentum distributions. The 0 2 τ (k(τ − τ )) moments of the intensity distribution of photon momenta i are the transfer functions ∆T (τ) and the moments of the E kl The CMB E-mode transfer function is then ∆l (τ) = E p distribution of photon polarizations are ∆kl(τ). (3/4) (l + 2)!/(l − 2)!E (τ). 1 l The temperature transfer functions can be written as A derivation of Eqs. (2) and (5) will be provided in (" # Ref. [14] using the total-angular-momentum formalism Z τ 1 h˙ (τ 0) ∆T (τ) = dτ 0 g(τ, τ 0) − k + ∆T (τ 0) j (x) [13], but it is easily verified that they agree with Eq. (18) kl 6 κ˙ (τ 0) k0 l τi in Ref. [15], Eqs. (74) and (77) in Ref. [12], and with the  0  0  IEs in Ref. [7]. It can also be verified, using the relation, 1 α˙ k(τ ) 1 0 LL 0 jl(x) − + Πk(τ ) R (x) + θbk(τ ) , 0 LL 0 l (2l + 1)jl(x) = ljl−1(x) − (l + 1)jl+1(x) (which Rl (x) 3 κ˙ (τ ) 2 k 0 and jl(x) also satisfy), that differentiation of these two (2) IEs recovers the usual Boltzmann hierarchy as given, for where x = k(τ − τ 0); a dot denotes a partial deriva- example, in Eqs. (2.4) of Ref. [5] or Eq. (63) of Ref. [16]. 0 tive with respect to τ; and g(τ, τ 0) = (d/dτ 0)e−κ(τ,τ ) = Thus, these two IEs are formally equivalent to the Boltz- 0 mann hierarchy. For completeness, the Boltzmann hier- κ˙ (τ 0) e−κ(τ,τ ) is the visibility function. The initial con- archy is provided in the notation/conventions used here formal time τ must be taken to be deep in the tight- i in Appendix A. coupling regime and will be discussed more below. Here, κ˙ (τ) = dκ/dτ is the opacity, the derivative of the Thomson-scattering optical depth with respect to con- III. IMPLEMENTATION formal time, and Z τ 0 The left flowchart in Fig. 1 shows the interdependency κ(τ, τ ) = dτ1 κ˙ (τ1). (3) τ 0 between the different perturbation variables in the dif- ferential equations for their evolution. In the middle are the metric-perturbation variables h and α. These are sourced by the baryon, dark-matter, neutrino, and 1 The notation here resembles largely that in Ref. [5]. The differ- photon densities and bulk velocities. Apart from the ences are that (i) the photon ∆T here is one quarter of theirs; kl baryon-photon coupling that connects θγ and θb, the (ii) the R here is the inverse of their R; (iii) theκ ˙ here is their −1 only communication between the different matter com- τC ; (iv) the α here is their h + 6η. The Π here is the same as that in Ref. [3] and is Π = (Fγ2 + Gγ0 + Gγ2)/4 in terms of the ponents is through the metric perturbations. The neu- variables in Ref. [5]. trino velocity is connected to the neutrino quadrupole 3

(a) (b)

FIG. 1: Flow charts for the perturbation calculation with (a) the Boltzmann hierarchy and (b) the integral-equation approach. An arrow points from an element that appears in the differential equation for the element it points to. Ingredients that appear in the integral equation for a given quantity are indicated in (b) with an integral sign. As both figures indicate, the higher T ν moments (l ≥ 3 for ∆l and ∆l and ≥ 2 for El) communicate to the rest of the system of equations only through the quadrupole T (l = 2). The diagrams also indicate that in both cases, the photon-intensity quadrupole ∆2 feeds into the rest of the system of equations only through the photon velocity θγ , and similarly for the neutrino quadrupole.

ν ∆2 which is then connected to an infinite tower of Boltz- plemented by those, mann equations for the higher-order neutrino moments ∆ν for l ≥ 3. The same can be said for the photon ˙ 1 ˙ ˙ 2 2 κ˙ l δb = −θb − h, θb = −Hθb + c k δb + Θγb, (8) velocity, except that there are two infinite Boltzmann 2 s R hierarchies for the higher photon-intensity and photon- for the baryon density and velocity, respectively. There polarization moments. When considered in tandem, the is also an equation, δ˙ = − 1 h˙ , for the CDM-density per- photon monopole and dipole equations combine into a c 2 turbation (the CDM peculiar velocity vanishes in syn- second-order differential equation that resembles that for chronous gauge). a driven simple harmonic oscillater (discussed below); The photon quadrupole ∆T(τ) in Eq. (7) is obtained this describes oscillations of the amplitude of the photon- 2 at early times by the TCA (up to second order inκ ˙ −1, baryon fluid driven by changes in the metric perturba- as described in Refs. [4, 5] for improved speed/precision). tions and in the photon quadrupole. The two equations for the early-time evolution of θ and In the line-of-sight approach [3], the Boltzmann hier- γ θb can also be replaced by their TCA, with the slip Θ˙ γb archy is solved up to a maximum multipole lmax ∼ 30 −1 to obtain the photon monopole, dipole, and quadrupole, evaluated (again, up to second orderκ ˙ ) [4, 5]. At later times, the quadrupole is obtained from Eq. (2) and Π to reasonable accuracy. The Cl are then obtained by evaluating the integrals in Eqs. (2) and (5). with l = 2, along with Eq. (5) for the time evolution of As Fig. 1 illustrates, the two (nominally) infinite towers Π(τ). With this approach, the equations in Eq. (7) com- of photon differential equations—one for the temperature bine to describe a driven oscillator damped by the photon T quadrupole [17]. The photon quadrupole is provided at moments (∆l for l ≥ 3) and polarization moments (El for l ≥ 2)—communicate with the rest of the system of early times by the TCA and at later times from the in- equations only through the photon-intensity quadrupole tegral equation. T For completeness, the Einstein equations are ∆2 . Thus, one can replace the two photon Boltzmann T hierarchies with a pair of integral equations, one for ∆2 ¨ a˙ ˙ 2 and another for Π. The rest of the system of equations h + h = −8πGa [δρtot + 3δptot] , (9) a is then exactly the same as in the Boltzmann approach. In this approach we retain the two lowest-order equa- tions, for the photon monopole (l = 0) and dipole (l = 1). 1 4 4  (h˙ − α˙ ) = 8πGa2 ρ¯ θ + ρ¯ θ +ρ ¯ θ , (10) These equations are, 3 3 γ γ 3 ν ν b b

˙ T 1 1 ˙ ˙ 2 T T ∆0 = − θγ − h, θγ = k (∆0 − 2∆2 ) − κ˙ Θγb, (7) Note that the the Einstein equations are written here in 3 6 terms of the energy and momentum densities, but not with Θγb(τ) ≡ θγ (τ) − θb(τ). These equations are sup- the anisotropic stress. In this way, the photon-intensity 4

T quadrupole ∆2 (τ) communicates with the rest of the set The integrals can then be written, of perturbation equations only through Eq. (7). The IEs τ Z d h 0 i for massless neutrinos are obtained from those for pho- I(τ) = dτ 0f(τ 0) e−κ(τ,τ ) f(τ) tons, but setting Π =κ ˙ = 0. These IEs have come into dτ 0 Z κn−1 play in the development of an effective ultra-relativistic- X  −κ(τ,τ 0) fluid approximation [5]. ' d e [fn−1 n=1 κn   # df 0 + 0 (κ − κ ) , (13) dκ n−1

IV. NUMERICAL SOLUTION OF THE where κn = κ(τ − nh), and h is the small conformal- 0 INTEGRAL EQUATIONS time step. The remaining κ integrals can then be done analytically and the derivative df/dκ0 approximated by differencing. Details are provided in Appendix B. The IEs here are Volterra equations of the second kind, By expanding the integrand f(τ) to linear order, as in which are typically solved as follows [18, 19]. A pair of Eq. (13), we obtain a result that is exact for variations such equations has the form, of f(τ) that are up to linear in κ. At early times, this then reproduces the first-order TCA (to orderκ ˙ −1), even for one step that is not necessarily small compared with Z t κ˙ −1. The second-order TCA is then recovered by evalu- f α(t) = Kαβ(t, s)f β(s)ds + gα(t). (11) a ating the IE with two time steps. This allows a smooth transition from the TCA approximation to the IE algo- rithm in Appendix B as long as the TCA values for the with α, β = 1, 2 (and implied sum over repeated α, β perturbation variables are stored for at least two time not not ij). They are solved on a mesh of N uniformly steps. At late times, the visibility function in Eq. (13) spaced time steps ti = a + ih with i = 1, 2,...,N, with can be Taylor expanded to linear order in ∆κ. Doing so h = (t − a)/N. The integrals are then evaluated with then recovers the trapezoidal scheme in Eq. (12). the trapezoidal rule. The solution to the IEs are then The formula in Eq. (12) requires for each time step i a fα,0 = gα,0 and sum over all earlier timesteps j < i. However, given the 0 e−κ(τ,τ ) factor in the visibility function in the integrand, the sum can for all practical purposes be started, for any     i−1 given τi at some j such that κ(τi, τj) ≤ ∆τmax ' 10 − 20. αβ 1 αβ β 1 αβ β X αβ β β δ − hKii fi = h  Ki0 f0 + Kij fj +gi . If the other factors in the integrand are slowly varying, 2 2 −∆τ j=1 this yields a precision degradation of . e max . (12) When the IE solver first begins, the photon-baryon For the pair of Volterra equations we deal with here, the fluid is still tightly coupled, and so the visibility function 2 × 2 matrix on the left-hand side must be inverted at has support only over values of τ 0 fairly close to τ; i.e., 0 −1 0 each time step [19]. The ordinary differential equations, (τ−τ ) . Nκ˙ . The argument x = k(τ−τ ) of the radial which must be solved simultaneously, are simply stepped eigenfunctions in Eq. (2) is thus small, and so the radial 2 forward in time (i.e., Euler integration). eigenfunctions can be approximated as j2(x) ' x /15, LL 0 αβ R2 (x) ' −1/5, j2(x) ' (2/15)x. The integrand cannot, This algorithm works well if the kernels K (t, s) are however, be approximated simply by the RLL(x) term, smooth and slowly varying. The visibility function in our −1 because Π is O(κ ˙ ) times θb. The third (i.e., the θb) integrands are smoothly varying after decoupling begins term contributes, at lowest order in the TCA. to occur, at redshifts z . 1400 (τ & 230 Mpc). The perturbation variables that multiply it, as well as the radial eigenfunctions, are also relatively smooth. The V. ITERATIVE SOLUTION OF INTEGRAL trapezoidal-rule integration therefore works reasonably AND DIFFERENTIAL EQUATIONS well. However, for early conformal times (τ . 230 Mpc) during tight coupling, whenκ ˙  H, the visibility func- The next step is to consider how to solve simultane- tion is very sharply peaked at τ 0 → τ. The trapezoidal ously the differential equations for the rest of the system. rule will therefore be inaccurate (unless we take a huge This includes those for the metric-perturbation variables, number of time steps). and the baryon and dark-matter densities and veloci- To remedy this, and to improve the transition from ties. It also in principle includes the neutrino pertur- tight coupling, we replace the trapezoidal rule in ∆τ 0 bation variables; here, however, I will assume that these 0 with one in de−κ(τ,τ ). More precisely, we write the inte- can be obtained with a generalized-dark-matter [20] or 0 grand in terms of the visibility function, (d/dτ 0)e−κ(τ,τ ), ultrarelativistic-fluid approximation (UFA) [5], both of times the more slowly-varying perturbation variables. which have been made fairly effective. In principle, the 5 integral-equation techniques described for photons here can be applied to the neutrino sector as well. For clarity, 0.2 I focus here, though, on the photon sector. In trying to do so, however, the coupling between the IEs and the DEs pose a chicken-and-egg problem: The 0.1 differential equations for the rest of the system require knowledge of ∆T(τ), but the IEs for ∆T(τ) cannot be ) 2 2 ( obtained without the solution to the DEs. One pos- 2 0.0 sibility is to solve the IEs and DEs simultaneously by simply stepping the differential equations forward—i.e., 0.1 Euler integration. This, however, requires very fine time steps, especially toward the end of the TCA, and thus eliminates the advantages of the early-time IE algorithm 0.2 described above. Another possibility is to step the IEs forward on a coarse time grid, and then integrate the 0 100 200 300 400 [Mpc] DEs forward (using an extrapolation of the IE solutions from earlier time steps) using an off-the-shelf adaptive- T time-step DE solver. FIG. 3: The transfer function ∆2 (τ) for the CMB photon- However, the IEs and DEs can be solved very efficiently intensity quadrupole as a function of conformal time τ for a Fourier mode of wavenumber k = 0.2 Mpc (which cor- with a simple iterative algorithm. Here, we start with T responds roughly to a CMB multipole moment l ∼ 3000). some initial anzatz for ∆2 (τ) and Π(τ) and then solve The black curve shows the results of the full Boltzmann hi- the DEs for all the other perturbation variables with erarchy as a function of conformal time. The other curves this ansatz. We then integrate the IEs using the solu- show results of the iterative integral-equation solution, taking T T tions to those DEs to obtain new values of ∆2 (τ) and ∆2 (τ) = 0 = Π(τ) as an initial ansatz. The yellowish curve T Π(τ). We then iterate. Of course, there is no guarantee shows the result for ∆2 (τ) after the first iteration—i.e., af- a priori that this iterative procedure will converge to the ter integrating the differential equations for all perturbation T correct answer, but some simple numerical experiments variables except ∆2 (τ) and Π(τ) and then integrating the in- T show that this procedure converges, and does so fairly tegral equations for ∆2 (τ) and Π(τ) using the results of the T differential equations. The red curve shows results after three quickly, even for a lousy (e.g., ∆2 (τ) = Π = 0) initial ansatz for the IE solutions. iterations, and the blue curve after five iterations. The thick- ness of the curves is such that if two are indistinguishable, the agreement between the two is O(0.1%).

0.020 iterative numerical implementation described here. To simplify, I approximate neutrinos (taken to be massless) 2 0.015 as a generalized-dark-matter component with w = cs = 2 cvis = 1/3 [20]. I stop the code at redshift z ' 560, after recombination but before reionization, and use an 0.010 analytic approximation (which takes into account only radiation and nonrelativistic matter at these times) for Visibility function 0.005 the expansion history. I use an ionization history from HyRec-2 [21]. To compare this IE approach with the standard Boltzmann hierarchy, I also wrote a second code 0.000 that is identical in every way except that it swaps out the T 0 100 200 300 400 integral equations for ∆2 (τ) and Π(τ) for the complete [Mpc] photon Boltzmann hierarchy. The code uses an off-the- shelf differential-equation solver [22] with adaptive step FIG. 2: The CMB visibility functionκ ˙ (τ0, τ) as a function of size, although not necessarily optimized for stiff equa- conformal time. It is shown to indicate the range of conformal tions. times, peaked at τ ' 280 Mpc, that contribute to the observed In the IE code, the handoff from the TCA to the IE CMB power spectra from recombination. solver takes place at τ = 160 Mpc. The Boltzmann code uses the same TCA at early times and then starts the full Boltzmann hierarchy at τ = 160 Mpc. The Boltzmann code follows the Boltzmann hierarchy up to lmax = 50 VI. NUMERICAL RESULTS (which I found was required to keep the perturbation variables stable over the τ range considered here). The I have written a rudimentary C code to calculate the results are similar, and the code a bit quicker, for smaller transfer functions for the perturbation variables with the lmax. The differential-equation solver in the Boltzmann 6

−5 T code runs with a relative error requirement of 10 and using as the initial ansatz the results for ∆2 (τ) and Π(τ) −4 absolute error of 10 . The integral equations are evolved from a prior run with Ωb reduced by 2%. This code con- on a time grid that has spacing ∆τ = 1.0 from 160 Mpc ≤ verges to O(0.1%) after just one iteration. τ ≤ 240 Mpc and 350 Mpc ≤ τ ≤ 450 Mpc, and ∆τ = 0.5 Mpc for 240 Mpc ≤ τ ≤ 350 Mpc, for a total of 401 grid points. The time required for the IE part of the VII. CONCLUSIONS AND IDEAS FOR calculation scales as the square of the number of grid FUTURE WORK points. Fig. 2 shows the visibility function, which indicates the I have presented an alternative formulation of the equa- conformal-time regime, 250 Mpc . τ . 400 Mpc, over tions for the evolution of cosmological perturbations in which the source functions for the CMB power spectra which the infinite Boltzmann hierarchy for the photon are evaluated. distribution function is replaced by a pair of integral Fig. 3 illustrates the results of the numerical experi- equations. There is no new physics here—it is simply ment. Shown there are results for the photon-intensity a recasting of the equations in a way that may lead to T quadrupole ∆2 (τ) of the Boltzmann code and the itera- physical insight and alternative schemes for numerical tive integral-equation results, starting from a naive initial solution. As was known from the line-of-sight approach T ansatz ∆2 (τ) = Π(τ) = 0. Results are shown for k = 0.2 [3], CMB fluctuations are determined only by the pho- Mpc, which corresponds roughly to CMB multipole mo- ton monopole (energy density), dipole (peculiar velocity), ments l ∼ 3000, near the upper limit of current mea- and quadrupole (more specifically, Π). In the Boltzmann surements. The frequency of oscillations in the transfer hierarchy, these are the result of some complicated trans- function are reduced at smaller k, and so the numerical fer of power between these lower moments of the photon algorithm should, if anything, work even better at lower distribution function and an infinite tower of higher mo- k. ments. The IE formalism shows, however, that the lower The results are shown for one iteration (yellow), three moments, and in particular the quadrupole moment, at iterations (red) and (five iterations) blue. The iterative the surface of last scatter (i.e., those that enter into the solutions converge first at early times and then require line-of-sight integration) are simply described by the ex- more iterations to converge at later times. The overlap act same equations that describe the lower moments that between the black and blue (5 iterations) curves indi- we see. cates that the agreement is at the O(0.1%) level over the I have shown that simple iterative solution of the com- conformal-time range that contributes to the observed bined system of integral and differential equations does a CMB power spectra. This IE code takes ∼ 0.15 times as pretty good job at reproducing the results of the Boltz- long to run as the Boltzmann code, implying that each mann calculation in a fraction of the time. This exercise iteration can be completed in ∼ 1/30 the time required also shows that the IE formalism can be implemented nu- for the Boltzmann code. Both codes are fairly rudimen- merically without (apparently) any significant numerical tary, and so these time comparisons should be taken with instabilities—this was not a foregone conclusion, given a grain of salt. Still, these results suggest that this may the occurrence of instabilities in some IE solvers [18], as provide a route to speeding up the standard Boltzmann well as those that may arise from finite lmax in the Boltz- codes. mann hierarchy. There may be room for even further improvement. The There is, however, far more work that needs to be done results shown in Fig. 3 are obtained using the most naive before we know whether this approach can implemented T possible initial ansatz for ∆2 (τ) and Π(τ). The number to speed up a code like CLASS or CAMB. These codes of iterations required for convergence to the required pre- benefit from a number of insights and clever algorithms, cision can be reduced if one starts with a better initial whereas what I have presented here is fairly naive. Those guess for these quantities. It should be possible to derive codes also have controlled errors, whereas the grid spac- a simple semi-analytic ansatz that interpolates between ing in my calculation was guessed to provide an O(0.1%) T the well-understood early-time TCA behavior and the precision in ∆2 (τ). late-time behavior, which comes from the Sachs-Wolfe The spacing of the conformal-time grid points in the effect. integral-equation solver is an obvious thing to explore. One should, however, be able to do even better. These In this calculation I simply estimated the number of calculations are not performed in isolation. In cosmo- grid points that would be required for O(0.1%) preci- logical MCMC analyses, the Boltzmann codes are run sion. However, the distribution of grid points can cer- repeatedly to map the likelihood functions in a multi- tainly be optimized to provide the desired observables dimensional cosmological-parameter space. Thus, each (e.g., CMB and matter power spectra) to the required time the calculation is done, it has presumably already precision. Good results can probably also be obtained been done for a nearby point in that cosmological pa- for smaller k with fewer grid points, given the smoother rameter space. Thus, it should be possible to start the integrands at lower k. The current code also sums over T iterative algorithm by using the results for ∆2 (τ) and all prior grid points. However, given the high opacity Π(τ) from a previous run. To test this, I ran the code at early times, the sum can be restricted only to grid 7 points that are at an optical depth ∆κ . 5 earlier. Appendix B: Details of the IE solver There are also algorithms, more sophisticated than the trapezoidal-rule algorithm used here, on numerical solu- We first define functions IT(τ, τ 0) and IΠ(τ, τ 0) by tion to Volterra equations (e.g., Ref. [23]) in the litera- writing ture that may be worth exploring. Finally, there may be alternative implementations of the integral/differential Z τ T 0 0 T 0 equations that may be better suited for numerics. For ∆2 (τ) = dτ g(τ, τ )I (τ, τ ). example, it should be possible to eliminate the differen- Z τ tial equations for the photon monopole and dipole and Π(τ) = dτ 0g(τ, τ 0)IΠ(τ, τ 0). (B1) T replace the integral equation for the quadrupole ∆2 (τ) T The integrals are then discretized, taking into account with that for the monopole ∆0 (τ). Or perhaps the dif- T the fact that Π(τ) appears in IT(τ, τ 0) and IΠ(τ, τ 0), in ferential equation for ∆2 (τ) can be included and the in- T the following way. We define two sums, tegral equation replaced by one for ∆3 (τ).

0 X T + T  1 + ∆ = I W + I Wj − Πj+1W Acknowledgments 2,i+1 j+1 j j 10 i j≤i

0 X Π + Π  3 + I thank L. Ji, R. Caldwell, D. Grin, J. Bernal, and Π = I W + I Wj − Πi+1W , i+1 j+1 j j 5 j E. Kovetz for useful discussions and comments on an ear- j≤i lier draft. This work was supported by NSF Grant No. T T Π 1818899 and the Simons Foundation. where Πi = Π(τi), Ij = I (τi+1, τj), and Ij = Π I (τi+1, τj). Here the weight functions are Appendix A: Boltzmann hierarchy  −∆κj  1 − (1 + ∆κj)e W + = e−κ(τi+1,τj+1) 1 − e−∆κj − , j ∆κ For completeness and comparison with prior work, I j e−κ(τi+1,τj+1) provide the Boltzmann equations for the photon mo-  −∆κj  Wj = 1 − (1 + ∆κj)e (B2) ments in the notation used here. These equations are ∆κj derived by differentiating Eqs. (2) and (5) with respect to τ. The independent variable τ appears in the limit where ∆κj = κ(τj+1) − κ(τj). These weight functions of integration, the visibility function, and in the radial + approach Wj → ∆κj/2 and Wj → ∆κj/2 at late times, eigenfunctions, and all of the radial eigenfunctions sat- thus recovering Eq. (12) (written as an integral over κ, 0 + isfy the spherical-Bessel-function relation, (2l+1)jl(x) = rather than τ). At early times, W → 1 − (∆κ)−1 and lj (x) − (l + 1)j (x). The monopole and dipole equa- j l−1 l+1 W j → (∆κ)−1; this then recovers the first-order tight- tions are already provided in Eq. (7). The equations for coupling approximation, ∆ = (2/5)Π = (4/45)(α ˙ + l ≥ 2 are 2 2θb)/κ˙ , even from one time step in the evaluation of kl k(l + 1) the integral—the second-order TCA is reproduced by two ∆˙ T = −κ˙ ∆T + ∆T − ∆T time steps. l l 2l + 1 l−1 2l + 1 l+1 1 α˙ κ˙ Π The discretized quadrupoles are then, + + δl2, 5 3 2 0 0 Πi+1 + ∆2,i+1 k(l − 2) k(l + 3) 1 Πi+1 = , E˙ = −κE˙ + E − E + κ˙ Πδ , 1 − 7 W + l l 2l + 1 l−1 2l + 1 l+1 15 l2 10 i 1 (A1) ∆T = ∆0 + Π0 W +. (B3) 2,i+1 2,i+1 10 i+1 i T with Π = ∆l + 9El.

[1] R. A. Sunyaev and Y. .B. Zeldovich, “Small scale fluc- and G. Efstathiou, “The statistics of cosmic background tuations of relic radiation,” Astrophys. Space Sci. 7, 3 radiation fluctuations,” Mon. Not. Roy. Astron. Soc. 226, (1970); P. J. E. Peebles and J. T. Yu, “Primeval adia- 655 (1987); M. L. Wilson and J. Silk, “On the Anisotropy batic perturbation in an expanding universe,” Astrophys. of the cosomological background matter and radiation J. 162, 815 (1970); J. Silk, “Fluctuations in the Primor- distribution. 1. The Radiation anisotropy in a spatially dial Fireball,” Nature 215, no.5106, 1155-1156 (1967) flat universe,” Astrophys. J. 243, 14 (1981); N. Vitto- [2] J. R. Bond and G. Efstathiou, “Cosmic background radi- rio and J. Silk, “Fine-scale anisotropy of the cosmic mi- ation anisotropies in universes dominated by nonbaryonic crowave background in a universe dominated by cold dark dark matter,” Astrophys. J. 285, L45 (1984); J. R. Bond matter,” Astrophys. J. 285, L39 (1984); 8

[3] U. Seljak and M. Zaldarriaga, “A Line of sight in- Phys. Rev. D 86, 125013 (2012) [arXiv:1209.0761 [astro- tegration approach to cosmic microwave background ph.CO]]. anisotropies,” Astrophys. J. 469, 437-444 (1996) [14] L. Ji and M. Kamionkowski, in preparation. [arXiv:astro-ph/9603033 [astro-ph]]. [15] M. Zaldarriaga and U. Seljak, “An all sky analysis of [4] F. Y. Cyr-Racine and K. Sigurdson, “Photons and polarization in the microwave background,” Phys. Rev. Baryons before Atoms: Improving the Tight-Coupling D 55, 1830-1840 (1997) [arXiv:astro-ph/9609170 [astro- Approximation,” Phys. Rev. D 83, 103521 (2011) ph]]. [arXiv:1012.0569 [astro-ph.CO]]. [16] C. P. Ma and E. Bertschinger, “Cosmological perturba- [5] D. Blas, J. Lesgourgues and T. Tram, “The Cosmic Lin- tion theory in the synchronous and conformal Newtonian ear Anisotropy Solving System (CLASS) II: Approxima- gauges,” Astrophys. J. 455, 7-25 (1995) [arXiv:astro- tion schemes,” JCAP 07, 034 (2011) doi:10.1088/1475- ph/9506072 [astro-ph]]. 7516/2011/07/034 [arXiv:1104.2933 [astro-ph.CO]]. [17] W. Hu and N. Sugiyama, “Anisotropies in the cosmic mi- [6] A. Lewis, A. Challinor and A. Lasenby, “Efficient compu- crowave background: An Analytic approach,” Astrophys. tation of CMB anisotropies in closed FRW models,” As- J. 444, 489 (1995) [astro-ph/9407093]; trophys. J. 538, 473-476 (2000) [arXiv:astro-ph/9911177 [18] P. Linz, “Analytical and Numerical Methods for Volterra [astro-ph]]. Equations,” (Society for Applied and Numerical Mathe- [7] S. Weinberg, “Damping of tensor modes in cosmology,” matics, 1985). Phys. Rev. D 69, 023503 (2004) [arXiv:astro-ph/0306304 [19] W. H. Press, S. A. Teukolsky, W. T. Vetterling and [astro-ph]]. B. P. Flannery, “Numerical Recipes in FORTRAN: The [8] D. Baskaran, L. P. Grishchuk and A. G. Polnarev, “Im- Art of Scientific Computing,” (Cambridge University prints of Relic Gravitational Waves in Cosmic Microwave Press, Cambridge, 1992). Background Radiation,” Phys. Rev. D 74, 083008 (2006) [20] W. Hu, “Structure formation with generalized dark mat- [arXiv:gr-qc/0605100 [gr-qc]]. ter,” Astrophys. J. 506, 485-494 (1998) [arXiv:astro- [9] R. Flauger and S. Weinberg, “Tensor Microwave Back- ph/9801234 [astro-ph]]. ground Fluctuations for Large Multipole Order,” Phys. [21] Y. Ali-Haimoud and C. M. Hirata, “HyRec: A fast Rev. D 75, 123505 (2007) [arXiv:astro-ph/0703179 and highly accurate primordial hydrogen and helium re- [astro-ph]]. combination code,” Phys. Rev. D 83, 043513 (2011) [10] J. R. Pritchard and M. Kamionkowski, “Cosmic mi- [arXiv:1011.3758 [astro-ph.CO]]; N. Lee and Y. Ali- crowave background fluctuations from gravitational Ha¨ımoud,“HYREC-2: a highly accurate sub-millisecond waves: An Analytic approach,” Annals Phys. 318, 2-36 recombination code,” Phys. Rev. D 102, no.8, 083517 (2005) [arXiv:astro-ph/0412581 [astro-ph]]. (2020) [arXiv:2007.14114 [astro-ph.CO]]. [11] S. Weinberg, “A No-Truncation Approach to Cosmic Mi- [22] L. Shampine and M. Gordon, “Computer Solution of Or- crowave Background Anisotropies,” Phys. Rev. D 74, dinary Differential Equations: The Initial Value Prob- 063517 (2006) [arXiv:astro-ph/0607076 [astro-ph]]. lem,” (Freeman, 1975). [12] W. Hu and M. J. White, “CMB anisotropies: Total an- [23] C. T. H. Baker, “A perspective on the numerical treat- gular momentum method,” Phys. Rev. D 56, 596-615 ment of the Volterra equations,” J. Comp. App. Math. (1997) [arXiv:astro-ph/9702170 [astro-ph]]. 1250, 217 (2000). [13] L. Dai, M. Kamionkowski and D. Jeong, “Total Angular Momentum Waves for Scalar, Vector, and Tensor Fields,”