(*:Mathematica Version: 2.0 *)

(*:Name: cosmology *)

(*:Title: Cosmological distance and time*)

(*:Author: E Loh *)

(*:History:
	6 Jan 97
*)

(*:Summary:
	This package provides functions for comoving coordinate, time,
	Hubble parameter, and radial distance.
*)

(*:Keywords:
*)

(*:Requirements: None. *)

(*:Warnings:
*)

(*:Sources: *)

BeginPackage["Cosmology`"];

(* Usage messages *)

comovingCoordinate::usage =
"comovingCoordinate[a, omega] computes the comoving coordinate for expansion
parameter a and density parameter omega.";

radialDistance::usage =
"radialDistance[a, omega] computes the radial distance for expansion
parameter a and density parameter omega.";

age::usage =
"age[a, omega] computes the age of the universe for expansion parameter a and
density parameter omega.";

hubbleParameter::usage =
"hubbleParameter[a, omega] computes the normalized Hubble parameter (where it 

is
1 at the present) for expansion parameter a and density parameter omega.";

Begin["`Private`"]

comovingCoordinate[a_, o_] :=
	( 1 - a ) / ( 1 + ( 1 - a ) ( o/2 - 1 ) /
	( 1 + Sqrt[ a^2 + a ( 1 - a ) o ] ) )

radialDistance[a_, o_/;o>1] :=
	ArcSin[ Sqrt[o-1] comovingCoordinate[a, o] ] / Sqrt[o-1]

radialDistance[a_, o_/;o==1] :=
	comovingCoordinate[a, 1]

radialDistance[a_, o_/;o<1] :=
	ArcSinh[ Sqrt[1-o] comovingCoordinate[a, o] ] / Sqrt[1-o]

age[a_,o_/;o==0] := a
age[a_,o_/;o==1] := 2a^(3/2)/3
age[a_,o_/;o>1] := Module[{u},u=a(o-1)/o;
	o(ArcSin@Sqrt[u]-Sqrt[u-u^2])/(o-1)^(3/2)]
age[a_,o_/;o<1] := Module[{u},u=a(1-o)/o;
	-o(ArcSinh@Sqrt[u]-Sqrt[u+u^2])/(1-o)^(3/2)]

hubbleParameter[a_, o_] :=
	Sqrt[ o ( 1 - a ) / a + 1 ] / a

End[ ]
EndPackage[ ]


(*:Limitations: None known. *)

(*:Tests:

*)

(*:Examples:


*)
