Introduction

SymBoltz.jl is a package for solving the Einstein–Boltzmann equations in cosmology. It solves the background and linear perturbations, and computes derived observables such as supernova distances and matter and CMB power spectra. It is easy to use and extend, and integrates with other Julia packages for scientific analysis.

Compared to traditional codes like CAMB and CLASS, SymBoltz offers three main features:

  • Symbolic-numeric: Represents the Einstein–Boltzmann equations symbolically and solves them numerically, and makes it easier to implement modified cosmological models (using ModelingToolkit.jl).
  • Approximation-free: Integrates the full stiff equations with implicit solvers (using OrdinaryDiffEq.jl). Remains as fast as approximation-based codes (e.g. with the TCA, UFA and RSA) due to analytical and sparse Jacobians.
  • Differentiable: Computes accurate gradients of any output with respect to any input parameters with automatic differentiation (using ForwardDiff.jl).

Installation and usage

Install Julia and launch it with julia -tauto. Then install and load SymBoltz:

using SymBoltz

This prompts to install SymBoltz if it is uninstalled. The option -tauto enables multithreading to parallelize internal computations. See examples in the sidebar on how to use SymBoltz, in particular the Getting started example.

Avoid restarting Julia!

Do not use SymBoltz by restarting julia -tauto myscript.jl repeatedly! This unnecessarily recompiles code and is slow with Julia's just-in-time compilation. Instead start julia -tauto once and run commands interactively, with include("myscript.jl") or with IJulia.jl notebooks. See Julia workflow tips for more.

Contributing

Contributions to SymBoltz are welcome! To modify the package source code, install SymBoltz in development mode:

using Pkg; Pkg.develop("SymBoltz")

Please feel free to open issues and pull requests in SymBoltz' repository.

Smoother development workflow with Revise

Use Revise.jl to automatically reload changes to source files without restarting Julia.