#!/usr/bin/perl
#
# Calculate the apparent transverse speed of a blob of material
#   in a jet moving at high speed nearly towards the observer.
#   MWR 12/15/2004
use POSIX;

$debug = 0;


# speed of blob, as fraction of speed of light
$v = 0.10;

# gamma factor
$gamma = 1.0/sqrt(1.0 - $v*$v);


printf "#%7s  %7s  %8s  %7s\n", "v/c", "theta", "'speed'", "gamma";

# theta is the angle away from the line of sight, degrees
for ($theta = 1.0; $theta < 90; $theta += 1.0) {

  $theta_rad = $theta*(3.14159/180.0);
  $x = $v*sin($theta_rad);
  $dt = (1.0 - $v*cos($theta_rad));
  $speed = $x/$dt;
  if ($debug > 0) {
    printf "  %7.1f %7.3f  %7.3f %7.3f %7.3f  %7.3f\n",
             $theta, $theta_rad, $x, $dt, $speed, $gamma;
  }

  printf " %7.3f  %7.1f  %8.4f  %7.3f\n", $v, $theta, $speed, $gamma;
}


exit 0;
