idlastro / Astronomical Utilities: GALAGE

[Source code]

NAME
GALAGE
PURPOSE
Determine the age of a galaxy given its redshift and a formation redshift.
CALLING SEQUENCE
age = galage(z, [zform,  H0 =, k=, lambda0 =, Omega_m= , q0 =, /SILENT])' 
INPUTS
z - positive numeric vector or scalar of measured redshifts 
zform - redshift of galaxy formation (> z), numeric positive scalar 
    To determine the age of the universe at a given redshift, set zform
    to a large number (e.g. ~1000).
OPTIONAL KEYWORD INPUTS
H0 - Hubble constant in km/s/Mpc, positive scalar, default is 70
/SILENT - If set, then the adopted cosmological parameters are not 
     displayed at the terminal.
    No more than two of the following four parameters should be
    specified.   None of them need be specified -- the adopted defaults
    are given. 
k - curvature constant, normalized to the closure density.   Default is
    0, (indicating a flat universe)
Omega_m -  Matter density, normalized to the closure density, default
    is 0.3.   Must be non-negative
Lambda0 - Cosmological constant, normalized to the closure density,
    default is 0.7
q0 - Deceleration parameter, numeric scalar = -R*(R'')/(R')^2, default
    is -0.55
OUTPUTS
age -  age of galaxy in years, will have the same number of elements
       as the input Z vector
EXAMPLE
(1) Determine the age of a galaxy observed at z = 1.5 in a cosmology with
Omega_matter = 0.3 and Lambda = 0.0.    Assume the formation redshift was
at z = 25, and use the default Hubble constant (=70 km/s/Mpc)
IDL> print,galage(1.5,25,Omega_m=0.3, Lambda = 0)
         ===> 3.35 Gyr
(2) Plot the age of a galaxy in Gyr out to a redshift of z = 5, assuming 
    the default cosmology (omega_m=0.3, lambda=0.7), and zform = 100
IDL> z = findgen(50)/10.
IDL> plot,z,galage(z,100)/1e9,xtit='z',ytit = 'Age (Gyr)'
PROCEDURE
For a given formation time zform and a measured z, integrate dt/dz from 
zform to z. Analytic formula of dt/dz in Gardner, PASP 110:291-305, 1998 
March  (eq. 7)
COMMENTS
(1) Integrates using the IDL Astronomy Library procedure QSIMP.    (The 
intrinsic IDL QSIMP() function is not called because of its ridiculous
restriction that only scalar arguments can be passed to the integrating
function.)    The function 'dtdz' is defined at the beginning of the 
routine (so it can compile first).
(2) Should probably be fixed to use a different integrator from QSIMP when
computing age from an "infinite" redshift of formation.    But using a 
large value of zform seems to work adequately.
 (3) An alternative set of IDL procedures for computing cosmological
parameters is available at 
        https://github.com/jlfischer/red-idl-cosmology
PROCEDURES CALLED
COSMO_PARAM, QSIMP
HISTORY
STIS version by P. Plait (ACC)                  June 1999
IDL Astro Version   W. Landsman (Raytheon ITSS)      April 2000
Avoid integer overflow for more than 32767 redshifts  July 2001