A Julia package for numerical evaluation of cosmic inflation models. Perturbations are solved for with the transport method. Supports an arbitrary number of fields, arbitrary field space metric, and arbitrary initial conditions.
Author rjrosati
9 Stars
Updated Last
1 Year Ago
Started In
March 2020


Build Status codecov DOI

A Julia package for numerical evaluation of cosmic inflation models. Perturbations are evolved with the transport method. It supports symbolic calculation of the equations of motion, and remains efficient at a high number of fields, even with non-canonical kinetic terms. If you use this in a publication, please cite via the Zenodo link.

Inflation.jlautomatically applies the horizon-crossing approximation, if the potential is detected to be sum-separable. Support is planned for automatic application of other approximations when they are valid as well.

Watch the talk given about this package at JuliaCon 2020:



For now, Inflation.jl is an unregistered Julia package. It can be installed with

julia> import Pkg

julia> Pkg.add("")

an example

using Inflation
using SymPy

# this is a quadratic inflation model with 10 fields and randomly selected masses

# set the field space dimension
d = 10

# set the model parameters, and their values
params = [symbols("m$i") for i in 1:d]
pvalues = rand(d)*1e-9

function G(Phi,p)
    d = length(Phi)
    g = Matrix{eltype(Phi)}(I,d,d)
    return g

function V(Phi,p)
    m = p
    return sum([ m[i]*Phi[i]^2)/2 for i in 1:d])

# set the initial conditions
Pi0 = zeros(d) # zero initial velocity

# pick a position randomly over the sphere, with radius to give ~N0 e-folds
N0 = 100
Phi0 = randn(d)
Phi0 ./= norm(Phi0)
Phi0 .*= sqrt(4*N0)

# symbolically construct the equations of motion
# because this potential is sum-separable, the horizon-crossing approximation will automatically be calculated
funcs = inflation_setup(d,V,G,params)

# solve the background equations of motion
sol = background_evolve(Phi0,Pi0,pvalues,funcs,verbose=true)

# solve the 2-pt correlation function equations of motion
# by default, use 7 k-values centered at a pivot scale of 0.002 Mpc^-1
tsol = transport_perturbations(sol,pvalues,funcs,verbose=true)


see the examples directory for more complicated potentials and metrics, how to scan parameter space, evaluate several simulations in parallel, output and analyze data.

At the moment, Inflation.jl can only solve the 2-pt correlation function equations of motion. Solving for higher-point correlation functions is possible with PyTransport/CppTransport.