#!/usr/bin/perl
#
# Calculate approximate mean opacities for comparative purposes
#
# MWR 2/12/2004

use POSIX;

$x = 0.70;
$z = 0.02;
$rho = 1e-4;

$kbf = 4.34e25*(1.0/100)*($z)*(1.0 + $x)*$rho;
$kff = 3.68e22*(1.0)*(1.0 - $z)*(1.0 + $x)*$rho;
$kes = 0.2*(1.0 + $x);


$start_t = 2e4;
$end_t = 1e8;
$dt = 1.1;


for ($t = $start_t; $t <= $end_t; $t *= $dt) {

  $xbf = $kbf*($t**-3.5);
  $xff = $kff*($t**-3.5);
  $xes = $kes;
  $sum = $xbf + $xff + $xes;

  printf "%9.4e %9.4e  %9.4e %9.4e %9.4e  %9.4e \n",
        $t, log10($t), log10($xbf), log10($xff), log10($xes), log10($sum);

}


exit (0);


# natural log
sub log10 {
  my $n = shift;
  return log($n)/log(10);
}

