#!/usr/bin/perl
#
#
# Make some fake data on velocity and distance we can plot
#   This version does high velocities, close to c
#

use POSIX;

$debug = 1;

# value of H in km/sec/Mpc
$H = 70;
# speed of light in m/s
$c = 3e8;

$outfile = "hubble_fake_rel.dat";
# velocity will be in m/s
@v_list = (0.01, 0.015, 0.02, 0.025, 0.03, 0.035, 0.04, 0.045,
           0.05, 0.065, 0.085, 0.10, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.50,
           0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 
             0.99, 0.999, 0.9999);
open(OUTFILE, ">$outfile") || die("can't open file $outfile");
printf OUTFILE "# fake perfect Hubble-Law data \n";
printf OUTFILE "#  v(km/sec)  dist(Mpc)  (m-M)    z \n";

foreach $v (@v_list) {

  # compute velocity in m/sec and km/sec
  $v_msec = $v*$c;
  $v_kmsec = $v_msec*0.001;

  # compute redshift using relativity
  $z = sqrt(  ((1.0 + $v)/(1.0 - $v)) ) - 1.0;

  # compute dist in Mpc using simple Hubble Law
  $dist_mpc = $v_kmsec/$H;
  # and in pc
  $dist_pc = $dist_mpc*1.0e6;
  $distmod = 5.0*log10($dist_pc) - 5.0;
  printf OUTFILE "  %9.4e  %9.4e  %6.3f  %10.4f \n",
        $v_kmsec, $dist_mpc, $distmod, $z;
}
close(OUTFILE);






exit 0;
