Physical Constants

The GSL physical constants are defined as Ruby constants under the modules

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

Contents:

  1. Fundamental Constants

  2. Astronomy and Astrophysics

  3. Atomic and Nuclear Physics

  4. Measurement of Time

  5. Imperial Units

  6. Nautical Units

  7. Printers Units

  8. Volume

  9. Mass and Weight

  10. Thermal Energy and Power

  11. Pressure

  12. Viscosity

  13. Light and Illumination

  14. Radioactivity

  15. Force and Energy

  16. Prefixes

  17. Examples

Fundamental Constants













Astronomy and Astrophysics







Atomic and Nuclear Physics



















Measurement of Time





Imperial Units






Nautical Units




Printers Units



Volume








Mass and Weight












Thermal Energy and Power





Pressure








Viscosity



Light and Illumination








Radioactivity




Force and Energy





Prefixes

















Example

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);

prev next

Reference index top