SymBoltz.jl: a symbolic-numeric, approximation-free and differentiable linear Einstein-Boltzmann solver

Herman Sletmoen · 2025

Read SymBoltz.jl: a symbolic-numeric, approximation-free and differentiable linear Einstein-Boltzmann solver by Herman Sletmoen (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2509-24740.txt.

Introduction

Herman Sletmoen writes a cosmology solver that takes its equations straight, with no approximations and no hand-derived gradients, in a 2025 paper. The linear Einstein-Boltzmann equations describe how the early universe's ripples grew, and standard codes switch approximations mid-flight to stay fast. His Julia package, SymBoltz, reads the modeler's own equations symbolically instead.

That knowledge automates the drudge work: splitting stages, building sparse derivative matrices, and pulling any variable from the answer. Stiff solvers carry the full equations throughout, yet speed matches the old codes. Exact automatic derivatives feed samplers and forecasts that live on gradients. Model builders gain a workbench where new physics slots in as spare parts.

Catalog record

CREATORHerman Sletmoen
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE102 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2509-24740

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

SymBoltz.jl: a symbolic-numeric, approximation-free and differentiable linear Einstein-Boltzmann solver Herman Sletmoen Abstract SymBoltz is a new Julia package that solves the linear Einstein-Boltzmann equations. It features a symbolic-numeric interface for specifying equations, is free of approximation switching schemes and is compatible with automatic differentiation. Cosmological models are built from replaceable physical components in a way that scales well in model space. The modeler should simply write down their equations, and SymBoltz solves them and eliminates much of the friction in the process. SymBoltz enables up to 100 × 100\times shorter model definitions compared to browsing equivalent files in CLASS. Symbolic knowledge enables powerful automation of tasks, such as separating computational stages like the background and perturbations, generating the Jacobian matrix and its sparsity pattern, and interpolating arbitrary expressions from the solution. Modern implicit solvers integrate the full stiff equations at all times, reducing slowdowns by taking long time steps, reusing the Jacobian and LU-factorizing it over several time steps, and using fast linear system solvers. Automatic differentiation gives exact derivatives of any output with respect to any input, which is important for gradient-based Markov chain Monte Carlo methods in large parameter spaces, training of emulators, Fisher forecasting and sensitivity analysis. These features are useful in their own rights, but also reinforce each other in a synergy. Results agree with established codes like CLASS and CAMB. With more work, SymBoltz can grow into an integrated symbolic-numeric cosmological modeling environment with a large library of models that delivers differentiable output as fast as other codes. SymBoltz is available at https://github.com/hersle/SymBoltz.jl with single-command installation and extensive documentation, and welcomes questions, suggestions and contributions. [ Scale = MatchLowercase, Path = fonts/, Extension = .ttf , UprightFont = *-Regular, ] Cosmology is at a crossroads ( Freedman 2017 ) . Despite the enormous success of the \mathrm{\Lambda CDM} model in explaining many observations, the increasing precision of modern observations are revealing tensions between theory and observations. These suggest that the current standard model is not the ultimate truth. On the theoretical side, this drives a search for the true cosmological model through modifications to \mathrm{\Lambda CDM} ( Bull et al. 2016 ) . Efficiently exploring the space of models benefits from numerical tools that are easy to modify. Minimizing friction in the modeling process encourages relaxing model-dependent approximations, creating user-friendly interfaces and structuring codes in modular components that are easy to replace. Some of the most important such tools in the cosmological modeling toolbox are linear Einstein-Boltzmann solvers ( ? Boltzmann codes ? ) like CAMB ( Lewis et al. 2000 ) and CLASS ( Lesgourgues 2011a ) . On the observational frontier, next-generation surveys like the Square Kilometer Array ( Dewdney et al. 2009 ) , Vera C. Rubin Observatory ( LSST Science Collaboration 2009 ) , Dark Energy Spectroscopic Instrument ( DESI Collaboration 2016 ) , Simon’s Observatory ( The Simons Observatory Collaboration 2019 ) and Euclid ( Euclid Collaboration 2025 ) promise even more precise data. Setting models apart with upcoming data involves both theoretical model parameters and experimental nuisance parameters that live side-by-side in large O(100) -dimensional spaces ( Piras et al. 2024 ) . In high dimensions, modern Markov chain Monte Carlo methods like Hamiltonian Monte Carlo and the No-U-Turn Sampler ( Hoffman & Gelman 2011 ) beat the traditional Metropolis-Hastings algorithm ( Hastings 1970 ) . These methods explore parameter space more efficiently, but need both the likelihood and its derivatives with respect to parameters. Differentiability is also increasingly important in other applications, such as forward-modeling field-level inference using simulations with initial conditions from Boltzmann solvers ( Seljak et al. 2017 ) . Automatic differentiation is a way to compute derivatives that is more accurate and can be faster than finite differences, which is an approximate and brute-force method. A differentiable Boltzmann solver is therefore a cornerstone in the next-generation cosmological modeling toolbox. SymBoltz is a new Boltzmann solver that aims to fill these gaps, featuring a convenient symbolic-numeric interface, approximation-freeness and differentiability. At its core, a Boltzmann code solves the gravitational (Einstein) equations for a gravitational theory coupled to some particle species described by thermodynamic (Boltzmann) equations up to first perturbative order around a homogeneous and isotropic universe. It can predict cosmic microwave background (CMB), baryon acoustic oscillation (BAO) or supernova (SN) observations; or be used in longer computations, such as to generate initial conditions to non-linear N -body simulations of large-scale structure. This article is structured as follows. Section 1 revisits the historical development of Boltzmann codes, sketches their structure, reviews methods for computing derivatives and motivates SymBoltz. Section 2 maps out the architecture and main features of SymBoltz and how it differs from other codes. Section 3 shows some example usage. Section 4 discusses synergies and tradeoffs in the design. Section 5 concludes with the current state of the code and future potential. The appendices list equations, implementation details, comparison settings and testing methods. 1 History and motivation Peebles & Yu 1970 were first to numerically integrate a comprehensive set of linearized Einstein-Boltzmann equations. Their work was refined over several years, and Ma & Bertschinger 1995 established the groundwork for modern Boltzmann solvers with their code COSMICS. Seljak & Zaldarriaga 1996 soon realized that one can integrate photon multipoles by parts to reduce many differential equations to one integral solution and released CMBFAST. Their line-of-sight integration method has become a standard technique that greatly speeds up the calculation, but requires truncating the multipoles in the differential equations. This Fortran codebase has since evolved into CAMB 1 1 1 https://camb.info/ written by Lewis et al. 2000 , which is one of the two most used and maintained Boltzmann solvers today. Doran 2005a ported CMBFAST to C++ with the fork CMBEASY, which structured the code in an object-oriented fashion and improved user-friendliness, but this project is abandoned today. Lesgourgues 2011a ; Blas et al. 2011 started the second major family of Boltzmann solvers with the birth of CLASS 2 2 2 http://class-code.net in C. It improved performance, user-friendliness, code flexibility, ease of modification and control over precision parameters. It was the first cross-check of CAMB from an independent branch and boosted the scientific accuracy of the Planck mission. Since then a healthy arms race have fueled refinements to CAMB and CLASS. Both codes have spawned many forks for studying alternative models and performing custom calculations. Today they are very well-made, efficient and reliable tools. More recently, the market has seen an influx of alternative solvers that target new numerical techniques, GPU parallelization, differentiability, interactivity and symbolic computation. Refregier et al. 2017 published the first symbolic-numeric Boltzmann code PyCosmo 3 3 3 https://pypi.org/project/PyCosmo/ , which automatically generates efficient C++ ODE code from user-provided symbolic equations, performs sparsity optimization on its Jacobian matrix and avoids the use of approximation schemes to speed up and stabilize the integration. Hahn et al. 2024 published the first differentiable Boltzmann solver DISCO-EB 4 4 4 https://github.com/ohahn/DISCO-EB in the JAX framework in Python, and relaxes approximation schemes to avoid complications and overhead when switching ODEs on GPUs. Bolt.jl 5 5 5 https://github.com/xzackli/Bolt.jl by Li et al. 2023 accomplishes much of the same in Julia. SymBoltz.jl 6 6 6 https://github.com/hersle/SymBoltz.jl is inspired by some of these

Read the complete text