Class Distances


  • public class Distances
    extends java.lang.Object
    Functions for converting between different measures of cosmological distance.

    The following parameters are used:

    • z: redshift
    • H0: Hubble constant in km/sec/Mpc (example value ~70)
    • omegaM: Density ratio of the universe (example value 0.3)
    • omegaLambda: Normalised cosmological constant (example value 0.7)

    For a flat universe, omegaM+omegaLambda=1

    The terms and formulae used here are taken from the paper by D.W.Hogg, Distance measures in cosmology, astro-ph/9905116 v4 (2000).

    Since:
    26 Jan 2007
    Author:
    Mark Taylor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double METRE_PER_PARSEC
      Number of metres in a parsec.
      static double SEC_PER_YEAR
      Number of seconds in a year.
      static double SPEED_OF_LIGHT
      Speed of light in m/s.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double angularDiameterDistance​(double z, double H0, double omegaM, double omegaLambda)
      Angular diameter distance.
      static double comovingDistanceL​(double z, double H0, double omegaM, double omegaLambda)
      Line-of-sight comoving distance.
      static double comovingDistanceT​(double z, double H0, double omegaM, double omegaLambda)
      Transverse comoving distance.
      static double comovingVolume​(double z, double H0, double omegaM, double omegaLambda)
      Comoving volume.
      static double lookbackTime​(double z, double H0, double omegaM, double omegaLambda)
      Lookback time.
      static double luminosityDistance​(double z, double H0, double omegaM, double omegaLambda)
      Luminosity distance.
      static double MpcToM​(double distMpc)
      Converts from MegaParsecs to metres.
      static double mToMpc​(double distM)
      Converts from metres to MegaParsecs.
      static double zToAge​(double z)
      Quick and dirty function for converting from redshift to time.
      static double zToDist​(double z)
      Quick and dirty function for converting from redshift to distance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SPEED_OF_LIGHT

        public static final double SPEED_OF_LIGHT
        Speed of light in m/s.
        See Also:
        Constant Field Values
      • METRE_PER_PARSEC

        public static final double METRE_PER_PARSEC
        Number of metres in a parsec.
        See Also:
        Constant Field Values
      • SEC_PER_YEAR

        public static final double SEC_PER_YEAR
        Number of seconds in a year.
        See Also:
        Constant Field Values
    • Method Detail

      • MpcToM

        public static double MpcToM​(double distMpc)
        Converts from MegaParsecs to metres.
        Parameters:
        distMpc - distance in Mpc
        Returns:
        distance in m
      • mToMpc

        public static double mToMpc​(double distM)
        Converts from metres to MegaParsecs.
        Parameters:
        distM - distance in m
        Returns:
        distance in Mpc
      • zToDist

        public static double zToDist​(double z)
        Quick and dirty function for converting from redshift to distance.

        Warning: this makes some reasonable assumptions about the cosmology and returns the luminosity distance. It is only intended for approximate use. If you care about the details, use one of the more specific functions here.

        Parameters:
        z - redshift
        Returns:
        some distance measure in Mpc
      • zToAge

        public static double zToAge​(double z)
        Quick and dirty function for converting from redshift to time.

        Warning: this makes some reasonable assumptions about the cosmology. It is only intended for approximate use. If you care about the details use one of the more specific functions here.

        Parameters:
        z - redshift
        Returns:
        'age' of photons from redshift z in Gyr
      • comovingDistanceL

        public static double comovingDistanceL​(double z,
                                               double H0,
                                               double omegaM,
                                               double omegaLambda)
        Line-of-sight comoving distance.
        Parameters:
        z - redshift
        H0 - Hubble constant in km/sec/Mpc
        omegaM - density ratio of the universe
        omegaLambda - normalised cosmological constant
        Returns:
        line-of-sight comoving distance in Mpc
      • comovingDistanceT

        public static double comovingDistanceT​(double z,
                                               double H0,
                                               double omegaM,
                                               double omegaLambda)
        Transverse comoving distance.
        Parameters:
        z - redshift
        H0 - Hubble constant in km/sec/Mpc
        omegaM - density ratio of the universe
        omegaLambda - normalised cosmological constant
        Returns:
        transverse comoving distance in Mpc
      • angularDiameterDistance

        public static double angularDiameterDistance​(double z,
                                                     double H0,
                                                     double omegaM,
                                                     double omegaLambda)
        Angular diameter distance.
        Parameters:
        z - redshift
        H0 - Hubble constant in km/sec/Mpc
        omegaM - density ratio of the universe
        omegaLambda - normalised cosmological constant
        Returns:
        angular diameter distance in Mpc
      • luminosityDistance

        public static double luminosityDistance​(double z,
                                                double H0,
                                                double omegaM,
                                                double omegaLambda)
        Luminosity distance.
        Parameters:
        z - redshift
        H0 - Hubble constant in km/sec/Mpc
        omegaM - density ratio of the universe
        omegaLambda - normalised cosmological constant
        Returns:
        luminosity distance in Mpc
      • lookbackTime

        public static double lookbackTime​(double z,
                                          double H0,
                                          double omegaM,
                                          double omegaLambda)
        Lookback time. This returns the difference between the age of the universe at time of observation (now) and the age of the universe at the time when photons of redshift z were emitted.
        Parameters:
        z - redshift
        H0 - Hubble constant in km/sec/Mpc
        omegaM - density ratio of the universe
        omegaLambda - normalised cosmological constant
        Returns:
        lookback time in Gyr
      • comovingVolume

        public static double comovingVolume​(double z,
                                            double H0,
                                            double omegaM,
                                            double omegaLambda)
        Comoving volume. This returns the all-sky total comoving volume out to a given redshift z.
        Parameters:
        z - redshift
        H0 - Hubble constant in km/sec/Mpc
        omegaM - density ratio of the universe
        omegaLambda - normalised cosmological constant
        Returns:
        comoving volume in Gpc3