A Cosmology Calculator for the World Wide Web
ABSTRACT
A cosmology calculator that computes times and distances as a function of redshift for user‐defined cosmological parameters has been made available online. This paper gives the formulae used by the cosmology calculator and discusses some of its implementation. A version of the calculator that allows one to specify the equation‐of‐state parameter w and
, and one for converting the light‐travel times usually given in the popular press into redshifts, is also located at the same site.
Received 2006 September 19; accepted 2006 October 10; published 2006 December 13
1. INTRODUCTION
There are many definitions of distance in cosmology, and it is often frustrating to calculate the kind of distance needed for a given situation. In particular, press releases (W. Clavin 2006, unpublished)2 very often use the “light‐travel time distance,”
, even though this distance has many undesirable characteristics. I wrote the cosmology calculator in order to be able to calculate
along with the observable angular and luminosity distances
and
, respectively. It also computes the proper radial distance, which is the only distance that is compatible with the common definition of distance for moving objects: the spatial separation at a common time. The common time used is right now, or
. This is called
below. The term
, also known as the comoving radial distance, is not measurable from a single position, but can in principle be measured by a family of comoving observers. It is the one distance that satisfies the Hubble law exactly—
—without any corrections. Other distances are defined using quantities taken from more than one time and generally only satisfy the Hubble law to first order.
2. EQUATIONS
The following results have been given many times before. Hogg (1999) gives equations that are equivalent to the ones in this paper, but for completeness in documenting the cosmology calculator, the equations are spelled out below.
The metric is given by
where
is
if
, and
for
. The radius of curvature is given by
, since I use the normalization that
at the current time, so the redshift is given by
. The past light cone is given by
, so the comoving radial distance is
and of course the light‐travel time distance is given by
The exact dynamics of the universe can be captured using the energy equation from the Newtonian approximation to cosmology, which gives
General relativity modifies the acceleration equation by including the pressure as a source of gravity, but this just cancels the variation of the enclosed mass
caused by the pressure, so the energy equation is exact. Thus, we can write
as
, with
where
is the deceleration parameter. Let us define a quantity Z that is the comoving distance divided by the Hubble radius
. Then
To first order, this agrees with the redshift, so
. This definition gives
and
. Thus, the angular size distance—defined as
, where R is the transverse proper length of an object that subtends an angle θ on the sky—is given by
We can define a function
, given by
Then
Note that the luminosity distance
is defined to make the inverse square law work perfectly for bolometric fluxes, so that
for an object of luminosity L.
The enclosed volume calculation requires the integral of either
or
. The closed case becomes
Note that
. The open case gives
The ratio of
to the Euclidean formula
is given by
in both the open and closed cases.
3. IMPLEMENTATION
The cosmology calculator is implemented as a Web page (CosmoCalc)3 that has a large number of JavaScript definitions in the header, followed by immediately executed JavaScript that writes a frame set to the current document. The frame set calls for the input form (CCform)4 and the output page (CCout).5 If JavaScript is not enabled, or if there is an error in the JavaScript, then the body of CosmoCalc is displayed. This body is just an error message saying that JavaScript must be enabled.
I have received several requests for the code used in the cosmology calculator; but since the code is in JavaScript, it is in the HTML files in ASCII form. It is easy to save the page source to get the code, and it is easy to modify the code using any text editor. If your modifications introduce an error, then you will see the error message saying that JavaScript must be enabled. This only means that you must find the error in your modified CosmoCalc. I have had to do this dozens of times, so do not be discouraged.
Even if you do not intend to modify the code, downloading the three HTML files will let you run the calculator locally when not connected to the Internet.
The numerical evaluation of the integrals for Z and t is done using the midpoint rule with 1000 panels. While this is not a very efficient use of CPU time, it was very easy to code. And with JavaScript, the CPU time is consumed on the user’s computer instead of on the server. The functions being integrated go smoothly to zero as a goes to zero, as long as
.
Another hidden aspect of the cosmology calculator is that it automatically sets the radiation density
to the value appropriate for
K and three massless neutrino species,
. Here
, and this factor includes a small (<1%) boost in the neutrino density due to a slight transfer to
annihilation energy into neutrinos (Hannestad & Madsen 1995). Therefore, if you want to verify some simple cases, such as the empty universe, you should use a large value of the Hubble constant, which reduces the relative importance of this radiation term. For example, the “Open” button with
and
gives an age of the universe of 9.934 Gyr, which is 0.7% from the expected 10 Gyr. But using
gives an age of 999 Myr, which is only 0.1% from the expected 1 Gyr.
For very early times, the age of the universe is adjusted to allow for the existence of
,
, etc., using the terms
and
for the standard model of particle physics given by Kolb & Turner (1990).
4. LIGHT‐TRAVEL TIME INVERSION
A slightly modified version of the cosmology calculator (DlttCalc) is also posted online.6 The input form asks for the light‐travel time in Gyr, instead of redshift. The redshift is found by evaluating the integral for light‐travel time in steps of −0.001 in a, starting from
until the input value is exceeded, and then interpolating to get a and thus z. Once z is known, the calculations proceed as in CosmoCalc.
5. MORE OPTIONS
Since the cosmology calculator was first written, there have been two developments that have changed the kinds of models that people want to run. I have created a new version of the cosmology calculator (ACC) that has more options and have made it available on the Web.7 One development is the discovery of neutrino oscillations, indicating that the assumption of massless neutrinos is not correct. The neutrino temperature is
K, and a typical momentum for a thermal neutrino is ≈
. This corresponds to the rest energy of a neutrino with
eV. Since the neutrinos thermalized while still relativistic, their distribution is that of a relativistic Fermi‐Dirac particle, so the neutrino density is given by
The number of spin states for a neutrino is one, but to allow for antineutrinos, one should use
.
The integral over neutrino momentum has to be evaluated for each step of the integration over a, so it needs to be done efficiently, even when the work is done on the user’s computer. In the low‐temperature limit when
, the integral over x evaluates to
, while in the high‐temperature limit
, the integral evaluates to
. Both limits can be evaluated correctly by approximating the integral using
with the single integration knot at
/
. This approximation has a maximum error of <3%. However, a better approximation is
with
and
, which has a maximum error <0.3%. The mass at which neutrinos are semirelativistic at the current epoch is
The final result is that the effective neutrino density can be written as
The normalization of 93.14 eV is from Mangano et al. (2005) and is 1.05% higher than the nominal, due to residual coupling of annihilation energy to the neutrinos. In the relativistic limit, the density is 1.53% higher. Increasing
by 0.48% over the nominal
when computing
allows for the relativistic limit, and this boost is included in equation (17).
This
is just a function of z that gives
at
and should not be confused with the actual
at z‐values other than zero. In ACC, the neutrino density at
is subtracted from the input
, giving separate
for the cold dark matter (CDM) and baryons, and
for the neutrinos. Of course, the neutrinos are not included in the radiation, so
.
For a hierarchical neutrino mass pattern with masses ≈0.001, 0.009, and 0.049 eV, the change in distances introduced by neutrino masses is negligible. At redshifts up to 5 in the Wilkinson Microwave Anisotropy Probe concordance flat ΛCDM cosmology with
and
, the changes are less than 0.01%. This mass pattern is the default when ACC is loaded. But even the more massive nearly degenerate neutrino mass patterns, such as ≈0.33, 0.33, and 0.33 eV, have a minimal effect on the distances and times.
The second change in the paradigm is the introduction of the equation of state
as a parameter in the model. I have implemented
as
, following Linder (2003), who added the factor of 2 normalization to the simple form used by Chevallier & Polarski (2001). This functional form behaves well at high redshift, and it allows an analytic solution for the dark energy density as a function of z. This solution is
The defaults are
and
, and in that case, ACC reduces to the CosmoCalc case.
Unlike the neutrino masses, changes in w have substantial effects on distances and ages. Changing w to −0.7 instead of the default −1 changes the age of the universe by 6% and the luminosity distance at
by 7% when
,
, and
are left unchanged. But for
, the model that is consistent with both supernovae (Riess et al. 2004, “gold+silver”) and the cosmic microwave background (Page et al. 2003, peak positions) changes to an open model with
,
, and
, and this gives an age change of 17% and a luminosity distance change of 21% at
. However, if
and
are allowed to vary as free parameters, the observable supernova signal in
is reduced to only 0.3% (Wright 2005).
Finally, ACC allows one to input
, allowing for easier tests of simple cases. With these changes, the X‐function is
The rest of the calculation of distances is unchanged.
6. CONCLUSION
These cosmology calculators are suitable for interactive use, providing fairly quick answers for single cases. Users who wish to use the code for large‐scale calculations should translate it into a compiled language and change the quadrature formula. In particular, if fitting to data sets with redshifts and distance, the data should be sorted by redshift, and the distance integrals should be evaluated for all objects in a single pass through the sorted data. Plotting figures is an obvious case in which redshifts are computed in order: Figure 1 shows the distance measures discussed in this paper as a function of z for three different models. The formulae presented here were translated into Postscript for this figure, resulting in a 4 kbyte file.
Fig. 1.— Four distance measures
,
,
, and
(bottom to top), plotted against a fifth distance measure, the redshift z, for three different cosmological models: an open CDM model, a flat ΛCDM model, and a closed CDM model. The center and right panels are consistent with the CMB angular power spectrum, while the left and center panels are consistent with large‐scale structure. Only the center panel is consistent with supernova data.
REFERENCES
- Chevallier, M., & Polarski, D. 2001, Int. J. Mod. Phys., 10, 213
- Hannestad, S., & Madsen, J. 1995, Phys. Rev. D, 52, 1764
- Hogg, D. 1999, preprint (astro‐ph/9905116v4)
- Kolb, E., & Turner, M. 1990, The Early Universe (Reading: Addison‐Wesley)
- Linder, E. 2003, Phys. Rev. Lett., 90, 091301
- Mangano, G., Miele, G., Pastor, S., Pinto, T., Pisanti, O., & Serpico, P. 2005, Nucl. Phys. B, 729, 221
- Page, L., et al. 2003, ApJS, 148, 233
- Riess, A., et al. 2004, ApJ, 607, 665
- Wright, E. 2005, NewA Rev., 49, 407
-
1 Department of Astronomy, University of California, Los Angeles, P.O. Box 951547, Los Angeles, CA 90095‐1547; wright@astro.ucla.edu.
-
2 See the JPL press release online at http://www.nasa.gov/centers/jpl/news/spitzerf‐20060321.html.
-
3 See http://www.astro.ucla.edu/∼wright/CosmoCalc.html.
-
4 See http://www.astro.ucla.edu/∼wright/CCform.html.
-
5 See http://www.astro.ucla.edu/∼wright/CCout.html.
-
6 See http://www.astro.ucla.edu/∼wright/DlttCalc.html.
-
7 See http://www.astro.ucla.edu/∼wright/ACC.html.
