#!/usr/bin/perl
# 
# Compute proper distance R as function of redshift
#   for several choices of Omega_M
#
# MWR 5/5/2011

$debug = 1;

# speed of light in m/s
$c = 2.9979E8;
# if H = 70 km/s/Mpc, it has this value in inverse seconds
$H = 2.27E-18;

$start_z = 0.0;
$end_z = 1.0;
$d_z = 0.05;

for ($z = $start_z; $z < $end_z; $z += $d_z) {

  $omega = 0.2;
  $R1 = (2.0*$c/$H)*(1/(1 + $z))*(1.0/($omega*$omega));
  $R1 *= ($omega*$z - (2.0 - $omega)*( sqrt(1 + $omega*$z) - 1.0));

  $omega = 1.0;
  $R2 = (2.0*$c/$H)*(1/(1 + $z))*(1.0/($omega*$omega));
  $R2 *= ($omega*$z - (2.0 - $omega)*( sqrt(1 + $omega*$z) - 1.0));

  $omega = 3.5;
  $R3 = (2.0*$c/$H)*(1/(1 + $z))*(1.0/($omega*$omega));
  $R3 *= ($omega*$z - (2.0 - $omega)*( sqrt(1 + $omega*$z) - 1.0));


  # convert distances from meters to Mpc
  $m_to_Mpc = 1.0/(3.08E22);
  $R1 *= $m_to_Mpc;
  $R2 *= $m_to_Mpc;
  $R3 *= $m_to_Mpc;
  printf " z %7.3f  R1 %9.4e R2 %9.4e R3 %9.4e \n",
        $z, $R1, $R2, $R3;
  
  
}

exit 0;

