1: % Cosmology calculator write-up
2:
3: \documentclass[12pt,preprint]{aastex}
4:
5: \shortauthors{Wright}
6:
7: \shorttitle{Cosmology Calculator}
8:
9: % my own definitions are here:
10: \newcommand{\iMAP} {{\sl WMAP}}
11: \newcommand{\dg} {\mbox{$^{\circ}$}}
12: \newcommand{\lsim} {\mbox{$_<\atop^{\sim}$}}
13: \newcommand{\gsim} {\mbox{$_>\atop^{\sim}$}}
14: \newcommand{\percm} {\mbox{${\rm cm}^{-1}$}}
15: \newcommand{\percmsq} {\mbox{${\rm cm}^{-2}$}}
16: \newcommand{\percmcub} {\mbox{${\rm cm}^{-3}$}}
17: \newcommand{\lt} {\mbox{$<$}}
18: \newcommand{\gt} {\mbox{$>$}}
19: \newcommand{\kms} {\mbox{${\rm ~km~s^{-1}}$}}
20: \newcommand{\Lsun} {\mbox{{\rm L_\odot}}}
21: \newcommand{\etal} {{\it et al.}}
22: \newcommand{\vs} {{\it vs.}}
23: \newcommand{\be} {\begin{equation}}
24: \newcommand{\ee} {\end{equation}}
25: \newcommand{\bea} {\begin{eqnarray}}
26: \newcommand{\eea} {\end{eqnarray}}
27:
28: \slugcomment{Draft: 6 Oct 2006}
29:
30: \begin{document}
31:
32: \title{A Cosmology Calculator for the World Wide Web}
33:
34: \author{
35: E.\ L.\ Wright\altaffilmark{1},
36: }
37:
38: \altaffiltext{1}{UCLA Astronomy, PO Box 951547, Los Angeles CA 90095-1547, USA}
39:
40: \email{wright@astro.ucla.edu}
41:
42: \begin{abstract}
43: A cosmology calculator that computes times and distances as a function of
44: redshift for user-defined cosmological parameters is available at
45: http://www.astro.ucla.edu/$\sim$wright/CosmoCalc.html.
46: This note gives the formulae used by the cosmology calculator and discusses
47: some of its implementation.
48: A version of the calculator that allows one to specify the equation of
49: state parameter $w$ and $w^\prime$ is at ACC.html, and a version for
50: converting the light travel times usually given in the popular press into
51: redshifts is at DlttCalc.html.
52: \end{abstract}
53:
54: \keywords{cosmology: miscellaneous -- methods: miscellaneous}
55:
56: \section{INTRODUCTION}\label{intro}
57:
58: There are many definitions of distances in cosmology, and it is often
59: frustrating to calculate the kind of distance needed for a given
60: situation. In particular, press releases (Clavin, 2006)
61: very often use the {\em light
62: travel time distance}, $D_{ltt} = c(t_\circ-t_{em})$, even though this
63: distance has very many undesirable characteristics. I wrote the
64: cosmology calculator in order to be able to calculate $D_{ltt}$ along
65: with the observable angular and luminosity distances $D_A$ and $D_L$.
66: It also computes the proper radial distance which is the only distance
67: that is compatible with the common definition of distance for moving
68: objects: the spatial separation at a common time. The common time
69: used is now, or $t_\circ$. This it is called $D_{now}$ below.
70: $D_{now}$, also known as the comoving radial distance, is not measurable from
71: a single position, but it can in principle be measured by a family of
72: comoving observers. It is the one distance that satisfies the Hubble
73: Law exactly: $dD/dt = H(t)D$ without any corrections. Other distances
74: are defined using quantities taken from more than one time and
75: generally only satisfy the Hubble Law to first order.
76:
77: \section{EQUATIONS \label{sec:obs}}
78:
79: The following results have been given many times before.
80: Hogg (1999) gives equations equivalent to the ones in this paper.
81: But for completeness in documenting the cosmology calculator
82: the equations are spelled out below.
83:
84: The metric is given by
85: \be
86: ds^2 = c^2dt^2 - a(t)^2 R_\circ^2 (d\psi^2 + S^2(\psi)[d\theta^2+
87: \sin^2\theta d\phi^2])
88: \ee
89: where $S(x)$ is $\sinh(x)$ if $\Omega_{tot} < 1$ and $\sin(x)$ for
90: $\Omega_{tot} > 1$. The radius of curvature is given by
91: $R_\circ = (c/H_\circ)/\sqrt{|1-\Omega_{tot}|}$
92: since I use the normalization that $a = 1$ at the current time so
93: the redshift is given by $1+z = 1/a$.
94: The past light cone is given by $c dt = a(t) R_\circ d\psi$ so
95: the comoving radial distance is
96: \be
97: D_{now} = R_\circ \psi = \int \frac{c dt}{a}
98: = \int_{1/(1+z)}^1 \frac{c da}{a\dot{a}}
99: \ee
100: and of course the light travel time distance is given by
101: \be
102: D_{ltt} = \int c dt = \int_{1/(1+z)}^1 \frac{c da}{\dot{a}}
103: = c(t_\circ - t(z))
104: \ee
105: The exact dynamics of the Universe can be captured using the
106: the energy equation from the Newtonian approximation to
107: cosmology, which gives
108: \be
109: \frac{\dot{a}^2}{2} - \frac{G M(<a)}{a} = \mbox{const}.
110: \ee
111: GR modifies the acceleration equation by including the pressure
112: as a source of gravity, but this just cancels the variation of
113: the enclosed mass $M(<a)$ caused by the pressure, so the energy
114: equation is exact.
115: So we can write $\dot{a}$ as $H_\circ \sqrt{X}$ with
116: \be
117: X(a) = \Omega_m/a + \Omega_r/a^2 + \Omega_v a^2 + (1-\Omega_{tot})
118: \approx 1 + 2q_\circ z + \ldots
119: \ee
120: where $q_\circ$ is the deceleration parameter.
121: Let us define a quantity $Z$ that is the comoving distance divided by
122: the Hubble radius $c/H_\circ$. Then
123: \be
124: Z = \int_{1/(1+z)}^1 \frac{da}{a\sqrt{X}} = \int_0^z \frac{dz}{(1+z)\sqrt{X}}
125: \approx z - z^2(1+q_\circ)/2 + \ldots
126: \ee
127: To first order this agrees with the redshift, so $Z = z+ \ldots$
128: % X \approx 1 + z*(Omega_m + 2*Omega_r - 2*Omega_v)
129: This definition gives
130: $D_{now} = (cZ/H_\circ)$ and
131: $D_{ltt} = (c/H_\circ) \int_{1/(1+z)}^1 da/\sqrt{X}$.
132: Then the angular size distance, which is defined as $D_A = R/\theta$
133: where $R$ is the transverse proper length of an object that subtends
134: an angle $\theta$ on the sky, is given by:
135: \bea
136: D_A & = & \frac{c}{H_\circ}
137: \frac{S(\sqrt{|1-\Omega_{tot}|}Z)}{(1+z)\sqrt{|1-\Omega_{tot}|}}
138: \nonumber \\
139: & = & \frac{D_{now}}{(1+z)}
140: \left(1 + \frac{1}{6} (1-\Omega_{tot}) Z^2 + \frac{1}{120}
141: (1-\Omega_{tot})^2 Z^4 + \ldots \right)
142: \eea
143: We can define
144: a function $J(x)$ given by
145: \be
146: J(x) = \cases{
147: \sin(\sqrt{-x})/\sqrt{-x}, & $x < 0$;\cr
148: \sinh(\sqrt{x})/\sqrt{x}, & $x > 0$;\cr
149: 1 + x/6 + x^2/120 + \ldots + x^n/(2n+1)! + \ldots, & $x \approx 0$.\cr
150: }
151: \ee
152: Then
153: \bea
154: D_{ltt} & = & \frac{c}{H_\circ} \int_{1/(1+z)}^1 \frac{da}{\sqrt{X}}
155: \nonumber \\
156: D_{now} & = & \frac{c}{H_\circ} \int_{1/(1+z)}^1 \frac{da}{a\sqrt{X}} =
157: \frac{cZ}{H_\circ}
158: \nonumber \\
159: D_A & = & D_{now} \frac{J([1-\Omega_{tot}]Z^2)}{1+z}
160: \nonumber \\
161: D_L & = & (1+z)^2 D_A
162: \eea
163: Note that the luminosity distance $D_L$ is defined to make the inverse
164: square law work perfectly for bolometric fluxes, so that
165: $F_{bol} = L/(4\pi D_L^2)$ for an object of luminosity $L$.
166:
167: The enclosed volume calculation requires the integral of
168: either $\sin^2\psi d\psi$ or $\sinh^2\psi d\psi$. The
169: closed case becomes
170: \be
171: V(<z) = 4\pi R_\circ^3 \int_0^\psi \frac{1-\cos 2\psi^\prime}{2} d\psi^\prime
172: = R_\circ^3 \left(\frac{\psi}{2}- \frac{\sin 2\psi}{4} \right)
173: \ee
174: Note that $\psi = \sqrt{|1-\Omega_{tot}|}Z(z)$. The open case gives
175: \be
176: V(<z) = 4\pi R_\circ^3 \left(\frac{\sinh 2\psi}{4} - \frac{\psi}{2}\right)
177: \ee
178: The ratio of $V(<z)$ to the Euclidean formula $(4\pi/3)(R_\circ \psi)^3$ is
179: given by
180: \bea
181: \frac{V(<z)}{(4\pi/3)(R_\circ \psi)^3} & = &
182: 1+\sum_{n=1}\frac{6\times4^n}{(2n+3)!}[(1-\Omega_{tot})Z(z)^2]^n
183: \nonumber \\
184: & = & 1 +\frac{1}{5}[(1-\Omega_{tot})Z(z)^2]
185: +\frac{2}{105}[(1-\Omega_{tot})Z(z)^2]^2 + \ldots
186: \eea
187: in both the open and closed cases.
188:
189: \section{IMPLEMENTATION\label{sec:analysis}}
190:
191: The cosmology calculator is implemented as a Web page
192: (CosmoCalc.html) that has
193: a large number of Javascript definitions in the header,
194: followed by immediately executed Javascript that writes a
195: frameset to the current document. The frameset calls
196: for the input form (CCform.html) and the output page
197: (CCout.html). If Javascript is not enabled, or if there
198: is an error in the Javascript, then the body of CosmoCalc.html
199: is displayed. This body is just an error message saying that
200: Javascript must be enabled.
201:
202: I have received several requests for the code used in the cosmology
203: calculator. But since the code is in Javascript, it is in the HTML
204: files in ASCII form.
205: It is easy to save the page source to get the code, and it
206: is easy to modify the code using any text editor. If your modifications
207: introduce an error, then you will see the error message saying that
208: Javascript must be enabled. This only means that you must find the error
209: in your modified CosmoCalc.html. I have had to do this dozens of times,
210: so don't be discouraged.
211:
212: Even if you do not intend to modify the code, downloading the three
213: HTML files will let you run the calculator locally when not connected
214: to the Internet.
215:
216: The numerical evaluation of the integrals for $Z$ and $t$ is done using
217: the mid-point rule with 1000 panels. While this is not a very efficient
218: use of CPU time, it was very easy to code. And with Javascript, the CPU
219: time is consumed on the user's computer instead of the server.
220: The functions being integrated go smoothly to zero as $a$ goes to zero
221: as long as $\Omega_r > 0$.
222:
223: Another hidden aspect of the cosmology calculator is that it
224: automatically sets the radiation density $\Omega_r h^2$ to the
225: value appropriate for $T_\circ = 2.72528$\,K and three massless
226: neutrino species, $\Omega_r h^2 = 4.165 \times10^{-5}$. Here $h
227: = H_\circ/100\;\mbox{km/sec/Mpc}$, and this factor includes a small
228: ($< 1\%$) boost in the neutrino density due to a slight transfer to
229: $e^+e^-$ annihilation energy into neutrinos (Hannestad \& Madsen, 1995).
230: So if you want to verify some
231: simple cases, like the empty Universe, you should use a large value of
232: the Hubble constant which reduces the relative importance of this
233: radiation term. For example, the open button with $H_\circ = 97.78$
234: and $\Omega_M = 0$ gives an age of the Universe of 9.934 Gyr which is
235: 0.7\% from the expected 10 Gyr.
236: But using $H_\circ = 977.8$ gives an age of 999 Myr which
237: is only 0.1\% from the expected 1\,Gyr.
238:
239: For very early times, the age of the Universe is adjusted to allow
240: for the existence of $e^+,e^-$, $\mu^+,\mu^-$, etc. using the
241: $g_*$ and $g_{*S}$ for the standard model of particle physics given
242: by Kolb \& Turner (1990).
243:
244: \section{Light travel time inversion}
245:
246: A slightly modified version of the cosmology calculator is at\\
247: http://www.astro.ucla.edu/$~\sim$wright/DlttCalc.html.\\
248: The input form asks for the light travel time in Gyr instead of redshift.
249: The redshift is found by evaluating the integral for light travel time
250: in steps of $-0.001$ in $a$ starting from $a=1$
251: until the input value is exceeded, and then
252: interpolating to get $a$ and thus $z$. Once $z$ is known the calculations
253: proceed as in CosmoCalc.html.
254:
255: \section{MORE OPTIONS\label{sec:discussion}}
256:
257: Since the cosmology calculator was first written, there have been two
258: developments that change the kinds of models that people want to run.
259: I have created a new version of the cosmology calculator with more
260: options and placed it in\\
261: http://www.astro.ucla.edu/$\sim$wright/ACC.html\\
262: One development is the discovery of neutrino oscillations, indicating
263: that the assumption of massless neutrinos is not correct. The neutrino
264: temperature is $(4/11)^{1/3} T_\circ = 1.95$\,K, and a typical momentum
265: for a thermal neutrino is $\approx 3 kT/c$. This corresponds to the rest
266: energy of a neutrino with $mc^2 \approx 0.0005$\,eV. Since the neutrinos
267: thermalized while still relativistic, their distribution is that of a
268: relativistic Fermi-Dirac particle, so the neutrino density is given by
269: \bea
270: \rho_\nu & = & 4\pi g_s h^{-3}
271: \sum_{e,\mu,\tau}
272: \left(\int \sqrt{m_\nu^2 + p^2/c^2} \; \frac{p^2 dp}{\exp(pc/kT_\nu)+1}\right)
273: \nonumber \\
274: & = & 4\pi g_s \left(\frac{kT_\nu}{hc}\right)^3 \sum_{e,\mu,\tau}
275: \left(\int \sqrt{m_\nu^2 +(x kT_\nu)^2/c^4}\;\frac{x^2 dx}{\exp(x)+1}\right)
276: \eea
277: The number of spin states for a neutrino is one, but to allow for
278: anti-neutrinos one should use $g_s = 2$.
279:
280: The integral over neutrino momentum has to be evaluated for each step of
281: the integration over $a$ so it needs to be done efficiently, even when the
282: work is done on the user's computer. In the low temperature limit when
283: $kT_\nu << m_\nu c^2$ the integral over $x$ evaluates to $m_\nu
284: (3/4)\zeta(3)\Gamma(3)$, while in the high temperature limit $kT_\nu >> m_\nu
285: c^2$ the integral evaluates to $(k T_\nu/c^2)(7/8)\zeta(4)\Gamma(4)$.
286: Both limits can be evaluated correctly by approximating the integral
287: using
288: \be
289: \int \sqrt{m_\nu^2 + x^2(kT_\nu)^2/c^4}\;\frac{x^2
290: dx}{\exp(x)+1} \approx m_\nu (3/4)\zeta(3)\Gamma(3) \sqrt{1+(x_1
291: kT_\nu/m_\nu c^2)^2}
292: \ee
293: with the single integration knot at $x_1 =
294: [(7/8)\zeta(4)\Gamma(4)]/[(3/4)\zeta(3)\Gamma(3)] = 3.151$. This
295: approximation has a maximum error of $< 3\%$. But a better
296: approximation is
297: \be
298: \int \sqrt{m_\nu^2 + x^2(kT_\nu)^2/c^4}\;\frac{x^2 dx}{\exp(x)+1}
299: = m_\nu (3/4)\zeta(3)\Gamma(3) f(x_1 kT_\nu/m_\nu c^2)
300: \ee
301: with
302: \be
303: f(y) \approx (1+y^\beta)^{1/\beta}
304: \ee
305: and $\beta = 1.842$ which
306: has a maximum error $< 0.3\%$. The mass at which neutrinos are
307: semi-relativistic at the current epoch is
308: \be
309: m_{rel}c^2 = x_1 kT_\nu = 0.000531(T_\circ/2.72528\;\mbox{K})\;\mbox{eV}
310: \label{eq:mrel}
311: \ee
312: The final result is that the effective neutrino
313: density can be written as
314: \be
315: \Omega_\nu(z) h^2 = \left(\frac{T_\circ}{2.72528\;\mbox{K}}\right)^3
316: \frac{\sum_{e,\mu,\tau} m_\nu f(m_{rel}(1+z)/m_\nu)}
317: {93.14\;\mbox{eV}/c^2}
318: \ee
319: The normalization of 93.14~eV is from Mangano \etal\ (2005) and is 1.05\%
320: higher than the nominal due to residual coupling of annihilation energy
321: to the neutrinos. In the relativistic limit the density is 1.53\% higher.
322: Increasing $T_\nu$ by 0.48\% over the nominal $(4/11)^{1/3}T_\circ$ when
323: computing $m_{rel}$ allows for the relativistic limit, and this boost is
324: included in Eq(\ref{eq:mrel}).
325:
326: This $\Omega_\nu(z)$ is just a function of $z$ which gives $\Omega_\nu$
327: at $z=0$ and should not be confused with the actual $\Omega_\nu$ at $z$'s
328: other than zero.
329: In ACC.html the neutrino density at $z=0$ is
330: subtracted from the input $\Omega_M$ giving separate $\Omega_{CM} =
331: \Omega_M - \Omega_\nu(z=0)$ for the CDM and baryons,
332: and $\Omega_\nu$ for the neutrinos.
333: Of course the neutrinos are not included in the radiation so
334: $\Omega_r h^2 = 2.778 \times 10^{-5} (T_\circ/2.72528)^4$.
335:
336: For a hierarchical neutrino mass pattern, with masses $\approx 0.001,
337: \;0.009\;\&\; 0.049$~eV, the change in distances introduced by
338: neutrino masses is negligible. At redshifts up to 5 in the
339: WMAP concordance flat $\Lambda$CDM
340: cosmology with $\Omega_M = 0.27$ and $H_\circ = 71$, the
341: changes are less than 0.01\%. This mass pattern is the default
342: when ACC.html is loaded. But even the more massive nearly
343: degenerate neutrino mass patterns such as $\approx 0.33,\;
344: 0.33\;\&\; 0.33$~eV have a minimal effect on the
345: distances and times.
346:
347: \begin{figure}[t]
348: \plotone{CC-fig1.ps}
349: \caption{The 4 distance measures $D_A$, $D_{ltt}$, $D_{now}$
350: and $D_L$ from bottom to top plotted against a fifth distance measure:
351: the redshift $z$, for 3 different cosmological
352: models: an open CDM model, a flat $\Lambda$CDM model, and a closed CDM model.
353: The center and right panels are consistent with the CMB angular power spectrum,
354: while the left and center panels are consistent with large scale structure.
355: Only the center panel is consistent with supernova data.\label{fig:Dsvsz}}
356: \end{figure}
357:
358: The second change in the paradigm is the introduction of the equation
359: of state $w(z) = P/\rho c^2$ as a parameter in the model. I have
360: implemented $w(z)$ as $w = w_\circ+2w^\prime(1-a)$ following Linder
361: (2003) who added the factor of ``2'' normalization
362: to the simple form used by Chevallier \& Polarski (2001).
363: This functional form behaves well at high redshift and it
364: allows an analytic solution for the dark energy density as a function
365: of $z$. This solution is
366: % d(ln\rho)/d\ln(a) = -3(1+w) = -3-3*w_o -6*w'(1-a) = -(3+3*w_o+6*w')-6*w'*a
367: % d\ln\rho = [-(3+3*w_o+6*w')/a -6*w']*da
368: % \rho = \rho_o * a^{-(3+3*w_o+6*w'))*exp(-6*w'*(1-a))
369: \be
370: \rho_{DE} = \rho_{DE,\circ} \; a^{-(3+3w_\circ+6w^\prime)} \;
371: \exp(-6w^\prime[1-a])
372: \ee
373: The defaults are $w = -1$ and $w^\prime = 0$ and in that case
374: ACC.html reduces to the CosmoCalc.html case.
375:
376: Unlike the neutrino masses, changes in $w$ have substantial effects on
377: distances and ages. Changing $w$ to $-0.7$ instead of the default $-1$
378: changes the age of the Universe by 6\% and the luminosity distance at $z=1$
379: by 7\% when $\Omega_M = 0.27$, $\Omega_{DE} = 0.73$, and $H_\circ = 71$
380: are left unchanged.
381: But for $w=-0.7$ the model consistent with both supernovae (Riess \etal\
382: 2004 gold+silver) and the CMB (Page \etal\ 2003 peak positions)
383: changes to an open model with $\Omega_M = 0.19$, $\Omega_{DE} = 0.74$ and
384: $H_\circ = 84$, and this gives an age change of 17\% and a luminosity distance
385: change of 21\% at $z=1$. However, if $\Omega_M$ and $\Omega_{DE}$ are allowed
386: to vary as free parameters, the observable supernova signal in $D_L$ is reduced
387: to only 0.3\% (Wright 2005).
388:
389: Finally ACC.html allows one to input $T_\circ$, allowing for easier tests
390: of simple cases.
391:
392: With these changes, the $X$ function is
393: \be
394: X(a) = (\Omega_{CM}+\Omega_\nu(z))/a + \Omega_{r}/a^2
395: + \Omega_{DE}\;a^{-(1+3w_\circ+6w^\prime)}\;\exp(-6w^\prime[1-a])
396: + (1-\Omega_{tot})
397: \ee
398: The rest of the calculation of distances is unchanged.
399:
400: \section{CONCLUSION\label{sec:conclusion}}
401:
402: These cosmology calculators are suitable for interactive use, providing fairly
403: quick answers for single cases. Users who wish to use the code for large scale
404: calculations should translate it into a compiled language and change the
405: quadrature formula. In particular, if fitting to datasets with redshifts and
406: distance, the data should be sorted by redshift and the distance integrals
407: evaluated for all objects in a single pass through the sorted data. Plotting
408: figures is an obvious case where redshifts are computed in order:
409: Figure \ref{fig:Dsvsz} shows the distance
410: measures discussed in this paper as a function of $z$ for 3 different
411: models. The formulae presented here were translated into Postscript
412: for this figure, resulting in a 4 kB file.
413:
414: \acknowledgements
415:
416: \thebibliography
417:
418: \bibitem{chevallier/polarksi;2001} Chevallier, M. \& Polarski, D. 2001,
419: Int. J. Mod. Phys., D10, 213.
420:
421: \bibitem{clavin;2006}
422: Clavin, W. 2006, JPL press release,\\
423: http://www.nasa.gov/centers/jpl/news/spitzerf-20060321.html
424:
425: \bibitem{hannestad/madsen;1995}
426: Hannestad, S. \& Madsen, J. 1995, PRD, 52, 1764-1769.
427:
428: \bibitem{hogg;1999} Hogg, D. 1999, astro-ph/9905116v4
429:
430: \bibitem{kolb/turner;1990} Kolb, E. \& Turner, M. 1990,
431: ``The Early Universe'', (Addison Wesley)
432:
433: \bibitem{linder;2003} Linder, E. 2003, PRL, 90, 091301
434:
435: \bibitem{mangano/etal;2005} Mangano, G., Miele, G., Pastor, S., Pinto, T.,
436: Pisanti, O. \& Serpico, P. 2005, Nucl.Phys. B, 729, 221-234. % hep-ph/0506164
437:
438: \bibitem{page/etal;2003}
439: Page, L. \etal, 2003, ApJS, 148, 233. % astro-ph/0302220
440:
441: \bibitem{riess/etal;2004}
442: Riess, A. \etal., 2004, \apj, 607, 665-687. % astro-ph/0402512
443:
444: \bibitem{wright;2005}
445: Wright, E. 2005, New Astronomy Reviews, 49, 407.
446:
447: \end{document}
448: