package Astro::Constants::CGS;
# ABSTRACT: this library provides physical constants for use in Astronomy

use strict;
use warnings;
use base qw/Exporter/;

use constant LIGHT_SPEED => 2.99792458e10;
use constant SPEED_LIGHT => 2.99792458e10;
*A_c = \2.99792458e10;
use constant BOLTZMANN => 1.38064852e-16;
*A_k = \1.38064852e-16;
use constant GRAVITATIONAL => 6.67408e-8;
*A_G = \6.67408e-8;
use constant ELECTRON_VOLT => 1.6021766208e-12;
*A_eV = \1.6021766208e-12;
use constant PLANCK => 6.626070040e-27;
*A_h = \6.626070040e-27;
use constant HBAR => 1.054571800e-27;
use constant H_BAR => 1.054571800e-27;
*A_hbar = \1.054571800e-27;
use constant CHARGE_ELEMENTARY => 4.8032046729e-10;
use constant ELECTRON_CHARGE => 4.8032046729e-10;
*A_e = \4.8032046729e-10;
use constant STEFAN_BOLTZMANN => 5.670367e-5;
*A_sigma = \5.670367e-5;
use constant A_RAD => 7.565723e-15;
use constant DENSITY_RADIATION => 7.565723e-15;
*A_arad = \7.565723e-15;
use constant WIEN => 2.8977729e-1;
*A_Wien = \2.8977729e-1;
use constant ALPHA => 7.2973525664e-3;
*A_alpha = \7.2973525664e-3;
use constant VACUUM_IMPEDANCE => 376.730313461;
use constant IMPEDANCE_VACUUM => 376.730313461;
*A_Z0 = \376.730313461;
use constant PERMITIVITY_0 => 1;
use constant PERMITIV_FREE_SPACE => 1;
*A_eps0 = \1;
use constant PERMEABILITY_0 => 1;
use constant CONSTANT_MAGNETIC => 1;
use constant PERMEABL_FREE_SPACE => 1;
*A_mu0 = \1;
use constant PI => 3.14159265358979324;
*A_pi = \3.14159265358979324;
use constant EXP => 2.71828182846;
*A_exp = \2.71828182846;
use constant ATOMIC_MASS_UNIT => 1.660539040e-24;
*A_amu = \1.660539040e-24;
use constant PARSEC => 3.08567758149e18;
*A_pc = \3.08567758149e18;
use constant ASTRONOMICAL_UNIT => 1.496e13;
*A_AU = \1.496e13;
use constant LIGHT_YEAR => 9.4607304725808e17;
*A_ly = \9.4607304725808e17;
use constant ANGSTROM => 1e-8;
*A_AA = \1e-8;
use constant JANSKY => 1e-23;
*A_Jy = \1e-23;
use constant AVOGADRO => 6.022140857e23;
*A_NA = \6.022140857e23;
use constant YEAR_JULIAN => 31_557_600;
use constant YEAR => 31_557_600;
*A_yr = \31_557_600;
use constant YEAR_TROPICAL => 31_556_925.1;
use constant YEAR_SIDEREAL => 31_558_149.8;
use constant YEAR_ANOMALISTIC => 31_558_432.6;
use constant YEAR_ECLIPSE => 29_947_974.3;
use constant SOLAR_MASS => 1.9884e33;
use constant MASS_SOLAR => 1.9884e33;
*A_msun = \1.9884e33;
use constant SOLAR_LUMINOSITY => 3.846e33;
use constant LUMINOSITY_SOLAR => 3.846e33;
*A_Lsun = \3.846e33;
use constant RHO_C => 1.8791e-29;
use constant DENSITY_CRITICAL_RHOc => 1.8791e-29;
*A_rhoc = \1.8791e-29;
use constant HUBBLE_TIME => 3.0853056e17;
*A_tH = \3.0853056e17;
use constant CMB_TEMPERATURE => 2.725;
use constant TEMPERATURE_CMB => 2.725;
*A_TCMB = \2.725;
use constant SOLAR_V_MAG => -26.74;
use constant MAGNITUDE_SOLAR_V => -26.74;
*A_Vsun = \-26.74;
use constant SOLAR_V_ABS_MAG => 4.83;
use constant MAGNITUDE_SOLAR_V_ABSOLUTE => 4.83;
*A_MVsun = \4.83;
use constant SOLAR_RADIUS => 6.96e10;
use constant RADIUS_SOLAR => 6.96e10;
*A_rsun = \6.96e10;
use constant EARTH_MASS => 5.9722e27;
use constant MASS_EARTH => 5.9722e27;
*A_mearth = \5.9722e27;
use constant EARTH_RADIUS => 6.378_136_6e8;
use constant RADIUS_EARTH => 6.378_136_6e8;
*A_rearth = \6.378_136_6e8;
use constant SOLAR_TEMPERATURE => 5778;
use constant TEMPERATURE_SOLAR_SURFACE => 5778;
*A_Tsun = \5778;
use constant SOLAR_DENSITY => 1.408;
use constant DENSITY_SOLAR => 1.408;
*A_dsun = \1.408;
use constant EARTH_DENSITY => 5.514;
use constant DENSITY_EARTH => 5.514;
*A_dearth = \5.514;
use constant SOLAR_GRAVITY => 27400;
use constant GRAVITY_SOLAR => 27400;
*A_gsun = \27400;
use constant EARTH_GRAVITY => 978;
use constant GRAVITY_EARTH => 978;
*A_gearth = \978;
use constant LUNAR_RADIUS => 1.7381e8;
use constant RADIUS_LUNAR => 1.7381e8;
*A_rmoon = \1.7381e8;
use constant LUNAR_MASS => 7.342e25;
use constant MASS_LUNAR => 7.342e25;
*A_mmoon = \7.342e25;
use constant LUNAR_SM_AXIS => 3.844e10;
use constant AXIS_SM_LUNAR => 3.844e10;
*A_amoon = \3.844e10;
use constant LUNAR_ECCENTRICITY => 0.0549;
use constant ECCENTRICITY_LUNAR => 0.0549;
*A_emoon = \0.0549;
use constant THOMSON_XSECTION => 6.6524587158e-25;
use constant THOMSON_CROSS_SECTION => 6.6524587158e-25;
*A_sigmaT = \6.6524587158e-25;
use constant ELECTRON_MASS => 9.10938356e-28;
use constant MASS_ELECTRON => 9.10938356e-28;
*A_me = \9.10938356e-28;
use constant PROTON_MASS => 1.672621898e-24;
use constant MASS_PROTON => 1.672621898e-24;
*A_mp = \1.672621898e-24;
use constant NEUTRON_MASS => 1.674927471e-24;
use constant MASS_NEUTRON => 1.674927471e-24;
*A_mn = \1.674927471e-24;
use constant HYDROGEN_MASS => 1.67372e-24;
use constant MASS_HYDROGEN => 1.67372e-24;
*A_mH = \1.67372e-24;
use constant MASS_ALPHA => 6.644_657_230e-27;
*A_ma = \6.644_657_230e-27;
use constant ELECTRON_RADIUS => 2.8179403227e-13;
use constant RADIUS_ELECTRON => 2.8179403227e-13;
*A_re = \2.8179403227e-13;
use constant BOHR_RADIUS => 5.2917721067e-9;
use constant RADIUS_BOHR => 5.2917721067e-9;
*A_a0 = \5.2917721067e-9;

# some helper functions
sub pretty {
	if (@_ > 1) {
		return map { sprintf("%1.5e", $_) } @_;
	}
	return sprintf("%1.5e", shift);
}

our @EXPORT_OK = qw( 
	LIGHT_SPEED SPEED_LIGHT BOLTZMANN GRAVITATIONAL ELECTRON_VOLT PLANCK HBAR H_BAR CHARGE_ELEMENTARY ELECTRON_CHARGE STEFAN_BOLTZMANN A_RAD DENSITY_RADIATION WIEN ALPHA VACUUM_IMPEDANCE IMPEDANCE_VACUUM PERMITIVITY_0 PERMITIV_FREE_SPACE PERMEABILITY_0 CONSTANT_MAGNETIC PERMEABL_FREE_SPACE PI EXP ATOMIC_MASS_UNIT PARSEC ASTRONOMICAL_UNIT LIGHT_YEAR ANGSTROM JANSKY AVOGADRO YEAR_JULIAN YEAR YEAR_TROPICAL YEAR_SIDEREAL YEAR_ANOMALISTIC YEAR_ECLIPSE SOLAR_MASS MASS_SOLAR SOLAR_LUMINOSITY LUMINOSITY_SOLAR RHO_C DENSITY_CRITICAL_RHOc HUBBLE_TIME CMB_TEMPERATURE TEMPERATURE_CMB SOLAR_V_MAG MAGNITUDE_SOLAR_V SOLAR_V_ABS_MAG MAGNITUDE_SOLAR_V_ABSOLUTE SOLAR_RADIUS RADIUS_SOLAR EARTH_MASS MASS_EARTH EARTH_RADIUS RADIUS_EARTH SOLAR_TEMPERATURE TEMPERATURE_SOLAR_SURFACE SOLAR_DENSITY DENSITY_SOLAR EARTH_DENSITY DENSITY_EARTH SOLAR_GRAVITY GRAVITY_SOLAR EARTH_GRAVITY GRAVITY_EARTH LUNAR_RADIUS RADIUS_LUNAR LUNAR_MASS MASS_LUNAR LUNAR_SM_AXIS AXIS_SM_LUNAR LUNAR_ECCENTRICITY ECCENTRICITY_LUNAR THOMSON_XSECTION THOMSON_CROSS_SECTION ELECTRON_MASS MASS_ELECTRON PROTON_MASS MASS_PROTON NEUTRON_MASS MASS_NEUTRON HYDROGEN_MASS MASS_HYDROGEN MASS_ALPHA ELECTRON_RADIUS RADIUS_ELECTRON BOHR_RADIUS RADIUS_BOHR
	$A_c $A_k $A_G $A_eV $A_h $A_hbar $A_e $A_sigma $A_arad $A_Wien $A_alpha $A_Z0 $A_eps0 $A_mu0 $A_pi $A_exp $A_amu $A_pc $A_AU $A_ly $A_AA $A_Jy $A_NA $A_yr $A_msun $A_Lsun $A_rhoc $A_tH $A_TCMB $A_Vsun $A_MVsun $A_rsun $A_mearth $A_rearth $A_Tsun $A_dsun $A_dearth $A_gsun $A_gearth $A_rmoon $A_mmoon $A_amoon $A_emoon $A_sigmaT $A_me $A_mp $A_mn $A_mH $A_ma $A_re $A_a0
	pretty
);

our %EXPORT_TAGS = ( 
	mathematical => [qw/ PI EXP /],
	cosmology => [qw/ SPEED_LIGHT LIGHT_SPEED GRAVITATIONAL PLANCK H_BAR HBAR STEFAN_BOLTZMANN DENSITY_RADIATION A_RAD WIEN ALPHA IMPEDANCE_VACUUM VACUUM_IMPEDANCE PARSEC ASTRONOMICAL_UNIT LIGHT_YEAR JANSKY YEAR YEAR_JULIAN YEAR_TROPICAL YEAR_SIDEREAL MASS_SOLAR SOLAR_MASS LUMINOSITY_SOLAR SOLAR_LUMINOSITY DENSITY_CRITICAL_RHOc RHO_C HUBBLE_TIME TEMPERATURE_CMB CMB_TEMPERATURE MAGNITUDE_SOLAR_V SOLAR_V_MAG MAGNITUDE_SOLAR_V_ABSOLUTE SOLAR_V_ABS_MAG /],
	electromagnetic => [qw/ SPEED_LIGHT LIGHT_SPEED BOLTZMANN ELECTRON_VOLT PLANCK H_BAR HBAR ELECTRON_CHARGE CHARGE_ELEMENTARY STEFAN_BOLTZMANN DENSITY_RADIATION A_RAD WIEN ALPHA IMPEDANCE_VACUUM VACUUM_IMPEDANCE PERMITIV_FREE_SPACE PERMITIVITY_0 PERMEABL_FREE_SPACE CONSTANT_MAGNETIC ANGSTROM JANSKY THOMSON_CROSS_SECTION THOMSON_XSECTION MASS_ELECTRON ELECTRON_MASS RADIUS_ELECTRON ELECTRON_RADIUS RADIUS_BOHR BOHR_RADIUS /],
	fundamental => [qw/ SPEED_LIGHT LIGHT_SPEED BOLTZMANN GRAVITATIONAL ELECTRON_VOLT PLANCK H_BAR HBAR ELECTRON_CHARGE CHARGE_ELEMENTARY STEFAN_BOLTZMANN DENSITY_RADIATION A_RAD WIEN ALPHA IMPEDANCE_VACUUM VACUUM_IMPEDANCE PERMITIV_FREE_SPACE PERMITIVITY_0 PERMEABL_FREE_SPACE CONSTANT_MAGNETIC /],
	planetary => [qw/ GRAVITATIONAL WIEN PARSEC ASTRONOMICAL_UNIT LIGHT_YEAR YEAR_ANOMALISTIC YEAR_ECLIPSE MASS_SOLAR SOLAR_MASS LUMINOSITY_SOLAR SOLAR_LUMINOSITY MAGNITUDE_SOLAR_V SOLAR_V_MAG MAGNITUDE_SOLAR_V_ABSOLUTE SOLAR_V_ABS_MAG RADIUS_SOLAR SOLAR_RADIUS MASS_EARTH EARTH_MASS RADIUS_EARTH EARTH_RADIUS TEMPERATURE_SOLAR_SURFACE SOLAR_TEMPERATURE DENSITY_SOLAR SOLAR_DENSITY DENSITY_EARTH EARTH_DENSITY GRAVITY_SOLAR SOLAR_GRAVITY GRAVITY_EARTH EARTH_GRAVITY RADIUS_LUNAR LUNAR_RADIUS MASS_LUNAR LUNAR_MASS AXIS_SM_LUNAR LUNAR_SM_AXIS ECCENTRICITY_LUNAR LUNAR_ECCENTRICITY /],
	short => [qw/ $A_c $A_k $A_G $A_eV $A_h $A_hbar $A_e $A_sigma $A_arad $A_Wien $A_alpha $A_Z0 $A_eps0 $A_mu0 $A_pi $A_exp $A_amu $A_pc $A_AU $A_ly $A_AA $A_Jy $A_NA $A_yr $A_msun $A_Lsun $A_rhoc $A_tH $A_TCMB $A_Vsun $A_MVsun $A_rsun $A_mearth $A_rearth $A_Tsun $A_dsun $A_dearth $A_gsun $A_gearth $A_rmoon $A_mmoon $A_amoon $A_emoon $A_sigmaT $A_me $A_mp $A_mn $A_mH $A_ma $A_re $A_a0 /],
	alternates => [qw/ LIGHT_SPEED HBAR CHARGE_ELEMENTARY A_RAD VACUUM_IMPEDANCE PERMITIVITY_0 PERMEABILITY_0 CONSTANT_MAGNETIC YEAR_JULIAN SOLAR_MASS SOLAR_LUMINOSITY RHO_C CMB_TEMPERATURE SOLAR_V_MAG SOLAR_V_ABS_MAG SOLAR_RADIUS EARTH_MASS EARTH_RADIUS SOLAR_TEMPERATURE SOLAR_DENSITY EARTH_DENSITY SOLAR_GRAVITY EARTH_GRAVITY LUNAR_RADIUS LUNAR_MASS LUNAR_SM_AXIS LUNAR_ECCENTRICITY THOMSON_XSECTION ELECTRON_MASS PROTON_MASS NEUTRON_MASS HYDROGEN_MASS ELECTRON_RADIUS BOHR_RADIUS /],
	nuclear => [qw/ ELECTRON_VOLT PLANCK H_BAR HBAR ELECTRON_CHARGE CHARGE_ELEMENTARY STEFAN_BOLTZMANN DENSITY_RADIATION A_RAD WIEN ALPHA IMPEDANCE_VACUUM VACUUM_IMPEDANCE PERMITIV_FREE_SPACE PERMITIVITY_0 PERMEABL_FREE_SPACE CONSTANT_MAGNETIC ATOMIC_MASS_UNIT ANGSTROM AVOGADRO THOMSON_CROSS_SECTION THOMSON_XSECTION MASS_ELECTRON ELECTRON_MASS MASS_PROTON PROTON_MASS MASS_NEUTRON NEUTRON_MASS MASS_HYDROGEN HYDROGEN_MASS MASS_ALPHA RADIUS_ELECTRON ELECTRON_RADIUS RADIUS_BOHR BOHR_RADIUS /],
	long => [qw/ LIGHT_SPEED SPEED_LIGHT BOLTZMANN GRAVITATIONAL ELECTRON_VOLT PLANCK HBAR H_BAR CHARGE_ELEMENTARY ELECTRON_CHARGE STEFAN_BOLTZMANN A_RAD DENSITY_RADIATION WIEN ALPHA VACUUM_IMPEDANCE IMPEDANCE_VACUUM PERMITIVITY_0 PERMITIV_FREE_SPACE PERMEABILITY_0 CONSTANT_MAGNETIC PERMEABL_FREE_SPACE PI EXP ATOMIC_MASS_UNIT PARSEC ASTRONOMICAL_UNIT LIGHT_YEAR ANGSTROM JANSKY AVOGADRO YEAR_JULIAN YEAR YEAR_TROPICAL YEAR_SIDEREAL YEAR_ANOMALISTIC YEAR_ECLIPSE SOLAR_MASS MASS_SOLAR SOLAR_LUMINOSITY LUMINOSITY_SOLAR RHO_C DENSITY_CRITICAL_RHOc HUBBLE_TIME CMB_TEMPERATURE TEMPERATURE_CMB SOLAR_V_MAG MAGNITUDE_SOLAR_V SOLAR_V_ABS_MAG MAGNITUDE_SOLAR_V_ABSOLUTE SOLAR_RADIUS RADIUS_SOLAR EARTH_MASS MASS_EARTH EARTH_RADIUS RADIUS_EARTH SOLAR_TEMPERATURE TEMPERATURE_SOLAR_SURFACE SOLAR_DENSITY DENSITY_SOLAR EARTH_DENSITY DENSITY_EARTH SOLAR_GRAVITY GRAVITY_SOLAR EARTH_GRAVITY GRAVITY_EARTH LUNAR_RADIUS RADIUS_LUNAR LUNAR_MASS MASS_LUNAR LUNAR_SM_AXIS AXIS_SM_LUNAR LUNAR_ECCENTRICITY ECCENTRICITY_LUNAR THOMSON_XSECTION THOMSON_CROSS_SECTION ELECTRON_MASS MASS_ELECTRON PROTON_MASS MASS_PROTON NEUTRON_MASS MASS_NEUTRON HYDROGEN_MASS MASS_HYDROGEN MASS_ALPHA ELECTRON_RADIUS RADIUS_ELECTRON BOHR_RADIUS RADIUS_BOHR /],
	conversion => [qw/ ELECTRON_VOLT ATOMIC_MASS_UNIT PARSEC ASTRONOMICAL_UNIT LIGHT_YEAR ANGSTROM JANSKY AVOGADRO YEAR YEAR_JULIAN YEAR_TROPICAL YEAR_SIDEREAL YEAR_ANOMALISTIC YEAR_ECLIPSE /],
);

'Perl is my Igor';

__END__

=pod

=encoding UTF-8

=head1 NAME

Astro::Constants::CGS - this library provides physical constants for use in Astronomy

=head1 VERSION

version 0.10

=head1 AUTHOR

Boyd Duffee <duffee@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Boyd Duffee.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
