Astro-Cosmology

 view release on metacpan or  search on metacpan

Cosmology.pm  view on Meta::CPAN

Symbols used in the following:

  om    is omega_matter
  ol    is omega_lambda
  ok    is 1 - om - ol
  kappa is sqrt( abs(ok) )

=head2 Distances

For cosmologies with no lambda term, the luminosity distances
(C<dl>) are calculated by the standard formulae:

  empty:     dl = 0.5 * z * (2+z)
  flat:      dl = 2 * ( 1+z - sqrt(1+z) )
  otherwise: dl = (2 / (om*om)) *
                  ( om*z + (om-2) * (sqrt(1+om*z)-1) )

For non-zero lambda cosmologies, the luminosity distance is
calculated using:

  closed:  dl = (1+z) * sin( kappa * dc ) / kappa
  open:    dl = (1+z) * sinh( kappa * dc ) / kappa
  flat:    dl = (1+z) * dc

where C<dc> is the comoving distance, calculated by numerical
integration of the following from 0 to C<z>:

  1.0 / sqrt( (1+z)^2 * (1+om*z) - z*(2+z)*ol )

The comoving distance is always calculated by numerical
integration of the above formula. The angular diameter and
proper motion distances are defined as
C<dl/(1+z)^2> and C<dl/(1+z)> respectively.

=head2 Volumes

If C<dm> is the proper motion distance, then the
comoving volume C<vc> is given by

 flat:   vc = dm^3 / 3
 open:   vc = dm * sqrt(1+ok*dm^2) - asinh(dm*kappa) /

Cosmology.pm  view on Meta::CPAN


  dvc = dm^2 * ddm / sqrt( 1 + ok*dm^2 )

where

  ddm = dc * sqrt( 1 + abs(ok) * dm^2 )

=head2 Times

The lookback time is calculated by integration of the following
formula from 0 to C<z>:

 1.0 / ( (1+z) * sqrt( (1+z)^2 * (1+om*z) - z*(2+z)*ol ) )

=head2 Flux and Magnitudes

The conversion between absolute and apparent magnitudes is
calculated using:

  $app_mag = $abs_mag + 25 + 5 * $cosmo->lum_dist($z)->log10();

t/cosmology2.t  view on Meta::CPAN


Outputs

=over 4

=item transverse comoving distance in units of the horizon distance

=back

Calls B<d_c()> to get the comoving distance, then computes curvature.
Uses formula from David Hogg's astro-ph/9905116 paper.

=cut

sub d_m {

  my $z = shift;
  my $matter = 0.3;
  my $lambda = 0.7;
  my $nsteps = 10000;

t/cosmology2.t  view on Meta::CPAN

=back

Outputs

=over 4

=item comoving volume in units of the Hubble volume

=back

Computes using an analytical formula from Carrol, Press and Turner, ARA&Ap, 1992, 30, 499

=cut

sub comoving_volume_z {

  my $z = shift;
  my $matter = 0.3;
  my $lambda = 0.7;
  my $nsteps = 10000;

t/cosmology2.t  view on Meta::CPAN

  $lambda = shift if(@_);
  $nsteps = shift if(@_);

  $nsteps = POSIX::floor($nsteps);

  my $curve = 1.0 - ($lambda + $matter);
  my $sacurve = sqrt(abs($curve));
  my $dm = d_m($z,$matter,$lambda,$nsteps);
  my $vc;

  # this formula is from Carrol, Press and Turner, ARA&Ap, 1992, 30, 499
  # however, it seems odd, as the volume will be negative for negative
  # curvature.

  if (!_not_flat($matter,$lambda)) {

    $vc = $dm**3;
    $vc /= 3.0;

  } elsif (_not_flat($matter,$lambda) < 0) {
    # negative curvature



( run in 0.249 second using v1.01-cache-2.11-cpan-26ccb49234f )