/*
###########################################################################
This function should be placed at the beginning of a program.
It defines the global constants that can be used in common by all programs
and built around it.
Once defined, these constants are globally accessible to all functions.
It only needs to be invoked once at the beginning of a program.
###########################################################################
*/
function Define_Constants()
{
/* -------------------------------------------
Speed of light in meters per second. Stolen
from NASA/JPL DE430 ephemeris constants.
Due to the way the length of a second and the
length of the meter are EXACTLY defined, this
speed of light is also an EXACT definition.
*/
define ('CLIGHT', '299792458');
// ------------------------------------------------------
// Standard gravitational acceleration on Earth (m/s^2).
define ('G_STD', '9.80665');
// ----------------------------------------
// Universal constant of gravitation (SI).
define ('G_UNI', '0.0000000000667430');
/* -------------------------------------------------------------------
Define some EXACT standard metric length/distance interconversion
factors in terms of meters per unit (M_PER_XXX). This is the
factor by which to multiply the units to obtain equivalent meters.
*/
define ('M_PER_A' , '0.0000000001'); // m per angstrom
define ('M_PER_NM' , '0.000000001'); // m per nanometer
define ('M_PER_UM' , '0.000001'); // m per micrometer (micron)
define ('M_PER_MM' , '0.001'); // m per millimeter
define ('M_PER_CM' , '0.01'); // m per centimeter
define ('M_PER_IN' , '0.0254'); // m per inch
define ('M_PER_FT' , '0.3048'); // m per foot
define ('M_PER_YD' , '0.9144'); // m per yard
define ('M_PER_M' , '1'); // m per meter
define ('M_PER_KM' , '1000'); // m per kilometer
define ('M_PER_MI' , '1609.344'); // m per mile (statute)
define ('M_PER_NMI' , '1852'); // m per nautical mile
define ('M_PER_LS' , '299792458'); // m per Light Second
define ('M_PER_LM' , '17987547480'); // m per Light Minute
define ('M_PER_LH' , '1079252848800'); // m per Light Hour
define ('M_PER_LD' , '25902068371200'); // m per Light Day
define ('M_PER_LW' , '181314478598400'); // m per Light Week
define ('M_PER_LY' , '9460730472580800'); // m per Light Year (365.25 d)
define ('KM_PER_NMI', '1.852'); // km per nautical mile
define ('KM_PER_MI' , '1.609344'); // km per statute mile
// ---------------------------------------------------
// Define the Astronomical Unit. EXACT adopted value.
define ('M_PER_AU' , '149597870700'); // NASA/IAU/DE430
define ('KM_PER_AU', '149597870.7');
/* -----------------------------------------------------
Derived factors based on the above adopted standards.
The AU used is the IAU value and the year value used
is the standard Julian year of exactly 365.25 days.
*/
define ('M_PER_LY' , '9460730472580800'); // EXACT
define ('MI_PER_AU' , '92955807.273');
define ('M_PER_PC' , '30856775814913672.7891393795779647');
define ('AU_PER_LY' , '63241.0770880709446742');
define ('AU_PER_PC' , '206264.8062470963551565');
define ('LD_PER_AU' , '0.00577551830441213');
// ----------------------------------
// Define some weight/mass standards.
define ('KG_PER_OZ' , '0.028349523125'); // EXACT
define ('KG_PER_LB' , '0.45359237'); // EXACT
define ('G_PER_OZ' , '28.349523125'); // EXACT
define ('N_PER_LB' , '4.4482216152605'); // EXACT DERIVED
// ---------------------------------
// Define number of seconds per day.
define ('S_PER_DAY' , '86400');
/* ---------------------------------------------------
Length of standard Julian calendar year in seconds.
One standard (Julian) year = Exactly 365.25 days.
*/
define ('S_PER_JY', '31557600');
/* ---------------------------------------------
Length of Gregorian calendar year in seconds.
One Gregorian year = Exactly 365.2425 days.
*/
define ('S_PER_GY', '31556952');
// ------------------------------------------------
// Define Planck constant (h = 6.62606896E-34 J/s).
define ('PLANCK_h', '0.000000000000000000000000000000000662606896');
/* -----------------------------------------
Define Stefan-Boltzmann constant (sigma).
Radiated energy = sigma * K**4 Watts per sq. meter per second
5.670373E-8 Watts/sq. meter/k^4
Where K = temperature in kelvins
*/
define ('STEF_BOLT_sigma', '0.00000005670373');
// -----------------------------------------------------
// Define Boltzmann constant (k) (SI). k value = W/K/s
define ('BOLTZ_k', '0.000000000000000000000013806504');
/* ---------------------------------------------------------------------
Define equatorial and polar radii of Earth in meters.
Based on the WGS-84/GPS ellipsoid model.
*/
define('R_EQU_EARTH', '6378137');
define('R_POL_EARTH', '6356752.314245');
define('R_MEAN_EARTH', '6367444.6571225');
// ---------------------------------------------------------------------
// Define equatorial and polar radii of Moon in meters (GPS ellipsoid).
define('R_EQU_MOON', '1738100');
define('R_POL_MOON', '1736000');
define('R_MEAN_MOON', '1737050');
/* ------------------------
Radius of sun in meters.
NASA: 696342 +/- 65 km = 432687 +/- 40 miles
*/
define('R_SUN', '696342000');
/* ======================================================================
Define some common PI-related constants to 256 decimals (not rounded).
These are for when higher than standard accuracy is needed for some
scientific calculations. These values can be used with the
arbitrary-precision BC (Binary Calculator) functions.
*/
define ('PI', '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485');
define ('PI_OVER_2', '1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126710585339910740432566411533235469223047752911158626797040642405587251420513509692605527798223114744774651909822144054878329667230642378241168933915826356009545728242');
define ('SQRT_PI', '1.7724538509055160272981674833411451827975494561223871282138077898529112845910321813749506567385446654162268236242825706662361528657244226025250937096027870684620376986531051228499251730289508262289320953792679628001746390153514797205167001901852340185854469');
define ('TWO_PI', '6.2831853071795864769252867665590057683943387987502116419498891846156328125724179972560696506842341359642961730265646132941876892191011644634507188162569622349005682054038770422111192892458979098607639288576219513318668922569512964675735663305424038182912970');
define ('PI2', '9.8696044010893586188344909998761511353136994072407906264133493762200448224192052430017734037185522318240259137740231440777723481220300467276106176779851976609903998562065756305715060412328403287808693527693421649396665715190445387352617794138202582605816929');
define ('FOUR_PI', '12.5663706143591729538505735331180115367886775975004232838997783692312656251448359945121393013684682719285923460531292265883753784382023289269014376325139244698011364108077540844222385784917958197215278577152439026637337845139025929351471326610848076365825940');
define ('PI3', '31.0062766802998201754763150671013952022252885658851076941445381038063949174657060375667010326028861930301219615723366223752016176523396727335613941544253882540336677275576626396750285320332468630426786986638396183752925629247300942969186202670539859607700678');
define ('RAD_PER_DEG', '0.0174532925199432957692369076848861271344287188854172545609719144017100911460344944368224156963450948221230449250737905924838546922752810123984742189340471173191682450150107695616975535812386053051687886912711720870329635896026424901877043509181733439396980');
define ('DEG_PER_RAD', '57.2957795130823208767981548141051703324054724665643215491602438612028471483215526324409689958511109441862233816328648932814482646012483150360682678634119421225263880974672679263079887028931107679382614426382631582096104604870205064442596568411201719120577397');
// ------------------------------------------------------------
// Some planetary mass constants as arbitrary-precision values.
define('MASS_VENUS_KG', '4867500000000000000000000');
define('MASS_VENUS_LB', '10731000000000000000000000');
define('MASS_EARTH_KG', '5972200000000000000000000');
define('MASS_EARTH_LB', '13166000000000000000000000');
define('MASS_MOON_KG', '73460000000000000000000');
define('MASS_MOON_LB', '161950000000000000000000');
define('MASS_MARS_KG', '641710000000000000000000');
define('MASS_MARS_LB', '1414700000000000000000000');
// ------------------------------------------------------------
// ---------------------------------------------------------------------
// Define inter-conversion factor between natural logarithms and base 10.
define ('LN_10', '2.30258509299404568401799145468436420760110148862877297603332790096757260967735248023599720508959829834196778403');
/* -------------------------------------------------
Define 3-letter English month name abbreviations
and 3-letter day of the week name abbreviations.
*/
define ('MONTH_ABBREVS', 'JanFebMarAprMayJunJulAugSepOctNovDec');
define ('DOW_ABBREVS', 'SunMonTueWedThuFriSat');
} // End of Define_Constants ()