The GSL physical constants are defined as Ruby constants under the modules
GSL::CONST::MKSA
(MKSA unit)GSL::CONST:CGSM
(CGSM unit)GSL::CONST:NUM
(Dimension-less constants)For example, the GSL C constant GSL_CONST_MKSA_SPEED_OF_LIGHT
is represented by a Ruby constant,
GSL_CONST_MKSA_SPEED_OF_LIGHT ---> GSL::CONST::MKSA::SPEED_OF_LIGHT
The following lists a part of the constants. Most of the constants are defined both in the modules GSL::CONST::MKSA
and GSL::CONST::CGSM
. See also the GSL reference
GSL::CONST::MKSA::SPEED_OF_LIGHT
GSL::CONST::MKSA::VACUUM_PERMEABILITY
GSL::CONST::MKSA::VACUUM_PERMITTIVITY
GSL::CONST::MKSA::PLANCKS_CONSTANT_H
GSL::CONST::MKSA::PLANCKS_CONSTANT_HBAR
GSL::CONST::NUM::AVOGADRO
GSL::CONST::MKSA::FARADAY
GSL::CONST::MKSA::BOLTZMANN
GSL::CONST::MKSA::STEFAN_BOLTZMANN_CONSTANT
GSL::CONST::MKSA::MOLAR_GAS
GSL::CONST::MKSA::STANDARD_GAS_VOLUME
GSL::CONST::MKSA::GAUSS
GSL::CONST::MKSA::ASTRONOMICAL_UNIT
GSL::CONST::MKSA::GRAVITATIONAL_CONSTANT
GSL::CONST::MKSA::LIGHT_YEAR
GSL::CONST::MKSA::PARSEC
GSL::CONST::MKSA::GRAV_ACCEL
GSL::CONST::MKSA::SOLAR_MASS
GSL::CONST::MKSA::ELECTRON_CHARGE
GSL::CONST::CGSM::ELECTRON_CHARGE_ESU
GSL::CONST::MKSA::ELECTRON_VOLT
GSL::CONST::MKSA::UNIFIED_ATOMIC_MASS
GSL::CONST::MKSA::MASS_ELECTRON
GSL::CONST::MKSA::MASS_MUON
GSL::CONST::MKSA::MASS_PROTON
GSL::CONST::MKSA::MASS_NEUTRON
GSL::CONST::NUM::FINE_STRUCTURE
GSL::CONST::MKSA::RYDBERG
GSL::CONST::MKSA::THOMSON_CROSS_SECTION
GSL::CONST::MKSA::BOHR_RADIUS
GSL::CONST::MKSA::ANGSTROM
GSL::CONST::MKSA::BARN
GSL::CONST::MKSA::BOHR_MAGNETON
GSL::CONST::MKSA::NUCLEAR_MAGNETON
GSL::CONST::MKSA::ELECTRON_MAGNETIC_MOMENT
GSL::CONST::MKSA::PROTON_MAGNETIC_MOMENT
GSL::CONST::MKSA::MINUTE
GSL::CONST::MKSA::HOUR
GSL::CONST::MKSA::DAY
GSL::CONST::MKSA::WEEK
GSL::CONST::MKSA::INCH
GSL::CONST::MKSA::FOOT
GSL::CONST::MKSA::YARD
GSL::CONST::MKSA::MILE
GSL::CONST::MKSA::MIL
GSL::CONST::MKSA::NAUTICAL_MILE
GSL::CONST::MKSA::FATHOM
GSL::CONST::MKSA::KNOT
GSL::CONST::MKSA::POINT
GSL::CONST::MKSA::TEXPOINT
GSL::CONST::MKSA::ACRE
GSL::CONST::MKSA::LITER
GSL::CONST::MKSA::US_GALLON
GSL::CONST::MKSA::CANADIAN_GALLON
GSL::CONST::MKSA::UK_GALLON
GSL::CONST::MKSA::QUART
GSL::CONST::MKSA::PINT
GSL::CONST::MKSA::POUND_MASS
GSL::CONST::MKSA::OUNCE_MASS
GSL::CONST::MKSA::TON
GSL::CONST::MKSA::METRIC_TON
GSL::CONST::MKSA::UK_TON
GSL::CONST::MKSA::TROY_OUNCE
GSL::CONST::MKSA::CARAT
GSL::CONST::MKSA::GRAM_FORCE
GSL::CONST::MKSA::POUND_FORCE
GSL::CONST::MKSA::KILOPOUND_FORCE
GSL::CONST::MKSA::POUNDAL
GSL::CONST::MKSA::CALORIE
GSL::CONST::MKSA::BTU
GSL::CONST::MKSA::THERM
GSL::CONST::MKSA::HORSEPOWER
GSL::CONST::MKSA::BAR
GSL::CONST::MKSA::STD_ATMOSPHERE
GSL::CONST::MKSA::TORR
GSL::CONST::MKSA::METER_OF_MERCURY
GSL::CONST::MKSA::INCH_OF_MERCURY
GSL::CONST::MKSA::INCH_OF_WATER
GSL::CONST::MKSA::PSI
GSL::CONST::MKSA::POISE
GSL::CONST::MKSA::STOKES
GSL::CONST::MKSA::STILB
GSL::CONST::MKSA::LUMEN
GSL::CONST::MKSA::LUX
GSL::CONST::MKSA::PHOT
GSL::CONST::MKSA::FOOTCANDLE
GSL::CONST::MKSA::LAMBERT
GSL::CONST::MKSA::FOOTLAMBERT
GSL::CONST::MKSA::CURIE
GSL::CONST::MKSA::ROENTGEN
GSL::CONST::MKSA::RAD
GSL::CONST::MKSA::NEWTON
GSL::CONST::MKSA::DYNE
GSL::CONST::MKSA::JOULE
GSL::CONST::MKSA::ERG
GSL::CONST::NUM::YOTTA
GSL::CONST::NUM::ZETTA
GSL::CONST::NUM::EXA
GSL::CONST::NUM::PETA
GSL::CONST::NUM::TERA
GSL::CONST::NUM::GIGA
GSL::CONST::NUM::MEGA
GSL::CONST::NUM::KILO
GSL::CONST::NUM::MILLI
GSL::CONST::NUM::MICRO
GSL::CONST::NUM::NANO
GSL::CONST::NUM::PICO
GSL::CONST::NUM::FEMTO
GSL::CONST::NUM::ATTO
GSL::CONST::NUM::ZEPTO
GSL::CONST::NUM::YOCTO
The following program demonstrates the use of the physical constants in a calculation. In this case, the goal is to calculate the range of light-travel times from Earth to Mars.
require("gsl") include GSL::CONST::MKSA puts("In MKSA unit") c = SPEED_OF_LIGHT; au = ASTRONOMICAL_UNIT; minutes = MINUTE; # distance stored in meters r_earth = 1.00 * au; r_mars = 1.52 * au; t_min = (r_mars - r_earth) / c; t_max = (r_mars + r_earth) / c; printf("light travel time from Earth to Mars:\n"); printf("c = %e [m/s]\n", c) printf("AU = %e [m]\n", au) printf("minutes = %e [s]\n", minutes) printf("minimum = %.1f minutes\n", t_min / minutes); printf("maximum = %.1f minutes\n\n", t_max / minutes);