stick 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -0
- data/COPYING +344 -0
- data/README +110 -0
- data/lib/stick/constants.rb +3 -0
- data/lib/stick/constants/cgs.rb +151 -0
- data/lib/stick/constants/mks.rb +158 -0
- data/lib/stick/constants/number.rb +33 -0
- data/lib/stick/constants/typeless_cgs.rb +141 -0
- data/lib/stick/constants/typeless_mks.rb +142 -0
- data/lib/stick/currency.rb +8 -0
- data/lib/stick/mapcar.rb +61 -0
- data/lib/stick/matrix.rb +1022 -0
- data/lib/stick/quaternion.rb +562 -0
- data/lib/stick/times.rb +441 -0
- data/lib/stick/units.rb +112 -0
- data/lib/stick/units/base.rb +980 -0
- data/lib/stick/units/currency.rb +159 -0
- data/lib/stick/units/data/binary/base.rb +4 -0
- data/lib/stick/units/data/cex.rb +5 -0
- data/lib/stick/units/data/currency-default.rb +5 -0
- data/lib/stick/units/data/currency-standard.rb +2 -0
- data/lib/stick/units/data/currency/base.rb +89 -0
- data/lib/stick/units/data/iec.rb +5 -0
- data/lib/stick/units/data/iec_binary/base.rb +6 -0
- data/lib/stick/units/data/si.rb +7 -0
- data/lib/stick/units/data/si/base.rb +9 -0
- data/lib/stick/units/data/si/derived.rb +26 -0
- data/lib/stick/units/data/si/extra.rb +22 -0
- data/lib/stick/units/data/uk.rb +10 -0
- data/lib/stick/units/data/uk/base.rb +22 -0
- data/lib/stick/units/data/units-default.rb +11 -0
- data/lib/stick/units/data/units-standard.rb +5 -0
- data/lib/stick/units/data/us.rb +10 -0
- data/lib/stick/units/data/us/base.rb +23 -0
- data/lib/stick/units/data/xmethods.rb +5 -0
- data/lib/stick/units/data/xmethods/cached.rb +84 -0
- data/lib/stick/units/data/xmethods/mapping.rb +87 -0
- data/lib/stick/units/loaders.rb +98 -0
- data/lib/stick/units/units.rb +109 -0
- data/meta/MANIFEST +76 -0
- data/meta/ROLLRC +2 -0
- data/meta/icli.yaml +16 -0
- data/meta/project.yaml +18 -0
- data/task/clobber/package +10 -0
- data/task/publish +57 -0
- data/task/release +10 -0
- data/task/setup +1616 -0
- data/task/test +25 -0
- data/test/spec_matrix.rb +342 -0
- data/test/test_currency.rb +26 -0
- data/test/test_matrix.rb +359 -0
- data/test/test_units.rb +205 -0
- data/work/TODO +20 -0
- data/work/bytes.rb +231 -0
- data/work/multipliers.rb +195 -0
- metadata +138 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
# Title:
|
2
|
+
#
|
3
|
+
# Math Constants CGS
|
4
|
+
#
|
5
|
+
# Copyright:
|
6
|
+
#
|
7
|
+
# Copyright (C) 2007 Stick Development Team
|
8
|
+
#
|
9
|
+
# License:
|
10
|
+
#
|
11
|
+
# GNU General Public License
|
12
|
+
#
|
13
|
+
# This program is free software; you can redistribute it and/or modify
|
14
|
+
# it under the terms of the GNU General Public License as published by
|
15
|
+
# the Free Software Foundation; either version 2 of the License, or (at
|
16
|
+
# your option) any later version.
|
17
|
+
#
|
18
|
+
# This program is distributed in the hope that it will be useful, but
|
19
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
21
|
+
# General Public License for more details.
|
22
|
+
#
|
23
|
+
# You should have received a copy of the GNU General Public License
|
24
|
+
# along with this program; if not, write to the Free Software
|
25
|
+
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
26
|
+
#
|
27
|
+
# Authors:
|
28
|
+
#
|
29
|
+
# - Daniel Carrera
|
30
|
+
# - Brian Gough
|
31
|
+
# - Thomas Sawyer
|
32
|
+
|
33
|
+
require 'stick/units'
|
34
|
+
|
35
|
+
module Stick
|
36
|
+
module Constants
|
37
|
+
|
38
|
+
# = Constants in the CGS system (cm, kg, s)
|
39
|
+
#
|
40
|
+
# Large assortment of real world contants. The constants are stored in
|
41
|
+
# the Math::Constants:CGS module. Math::Constants::CGS provides the
|
42
|
+
# constants in cm kg s format, opposed to the standard m kg s.
|
43
|
+
#
|
44
|
+
# == Synopsis
|
45
|
+
#
|
46
|
+
# Stick::Constant::CGS::SPEED_OF_LIGHT #=> 2.99792458e10 cm / s
|
47
|
+
|
48
|
+
module CGS
|
49
|
+
extend Units
|
50
|
+
|
51
|
+
SPEED_OF_LIGHT = 2.99792458e10.cm/s # cm / s
|
52
|
+
GRAVITATIONAL_CONSTANT = 6.673e-8.cm**3/g*s**2 # cm^3 / g s^2
|
53
|
+
PLANCKS_CONSTANT_H = 6.62606876e-27.g*cm*82/s # g cm^2 / s
|
54
|
+
PLANCKS_CONSTANT_HBAR = 1.05457159642e-27.g*cm**2/s # g cm^2 / s
|
55
|
+
VACUUM_PERMEABILITY = 1.25663706144e-1.cm*g/A**2*s**2 # cm g / A^2 s^2
|
56
|
+
ASTRONOMICAL_UNIT = 1.49597870691e13.cm # cm
|
57
|
+
LIGHT_YEAR = 9.46053620707e17.cm # cm
|
58
|
+
PARSEC = 3.08567758135e18.cm # cm
|
59
|
+
GRAV_ACCEL = 9.80665e2.cm/s**2 # cm / s^2
|
60
|
+
ELECTRON_VOLT = 1.602176462e-12.g*cm**2/s**2 # g cm^2 / s^2
|
61
|
+
MASS_ELECTRON = 9.10938188e-28.g # g
|
62
|
+
MASS_MUON = 1.88353109e-25.g # g
|
63
|
+
MASS_PROTON = 1.67262158e-24.g # g
|
64
|
+
MASS_NEUTRON = 1.67492716e-24.g # g
|
65
|
+
RYDBERG = 2.17987190389e-11.g*cm**2/s**2 # g cm^2 / s^2
|
66
|
+
BOLTZMANN = 1.3806503e-16.g*cm**2/K*s**2 # g cm^2 / K s^2
|
67
|
+
BOHR_MAGNETON = 9.27400899e-20.A*cm**2 # A cm^2
|
68
|
+
NUCLEAR_MAGNETON = 5.05078317e-23.A*cm**2 # A cm^2
|
69
|
+
ELECTRON_MAGNETIC_MOMENT = 9.28476362e-20.A*cm**2 # A cm^2
|
70
|
+
PROTON_MAGNETIC_MOMENT = 1.410606633e-22.A*cm**2 # A cm^2
|
71
|
+
MOLAR_GAS = 8.314472e7.g*cm**2/K*mol*s**2 # g cm^2 / K mol s^2
|
72
|
+
STANDARD_GAS_VOLUME = 2.2710981e4.cm**3/mol # cm^3 / mol
|
73
|
+
MINUTE = 6e1.s # s
|
74
|
+
HOUR = 3.6e3.s # s
|
75
|
+
DAY = 8.64e4.s # s
|
76
|
+
WEEK = 6.048e5.s # s
|
77
|
+
INCH = 2.54e0.cm # cm
|
78
|
+
FOOT = 3.048e1.cm # cm
|
79
|
+
YARD = 9.144e1.cm # cm
|
80
|
+
MILE = 1.609344e5.cm # cm
|
81
|
+
NAUTICAL_MILE = 1.852e5.cm # cm
|
82
|
+
FATHOM = 1.8288e2.cm # cm
|
83
|
+
MIL = 2.54e-3.cm # cm
|
84
|
+
POINT = 3.52777777778e-2.cm # cm
|
85
|
+
TEXPOINT = 3.51459803515e-2.cm # cm
|
86
|
+
MICRON = 1e-4.cm # cm
|
87
|
+
ANGSTROM = 1e-8.cm # cm
|
88
|
+
HECTARE = 1e8.cm**2 # cm^2
|
89
|
+
ACRE = 4.04685642241e7.cm**2 # cm^2
|
90
|
+
BARN = 1e-24.cm**2 # cm^2
|
91
|
+
LITER = 1e3.cm**3 # cm^3
|
92
|
+
US_GALLON = 3.78541178402e3.cm**3 # cm^3
|
93
|
+
QUART = 9.46352946004e2.cm**3 # cm^3
|
94
|
+
PINT = 4.73176473002e2.cm**3 # cm^3
|
95
|
+
CUP = 2.36588236501e2.cm**3 # cm^3
|
96
|
+
FLUID_OUNCE = 2.95735295626e1.cm**3 # cm^3
|
97
|
+
TABLESPOON = 1.47867647813e1.cm**3 # cm^3
|
98
|
+
TEASPOON = 4.92892159375e0.cm**3 # cm^3
|
99
|
+
CANADIAN_GALLON = 4.54609e3.cm**3 # cm^3
|
100
|
+
UK_GALLON = 4.546092e3.cm**3 # cm^3
|
101
|
+
MILES_PER_HOUR = 4.4704e1.cm/s # cm / s
|
102
|
+
KILOMETERS_PER_HOUR = 2.77777777778e1.cm/s # cm / s
|
103
|
+
KNOT = 5.14444444444e1.cm/s # cm / s
|
104
|
+
POUND_MASS = 4.5359237e2.g # g
|
105
|
+
OUNCE_MASS = 2.8349523125e1.g # g
|
106
|
+
TON = 9.0718474e5.g # g
|
107
|
+
METRIC_TON = 1e6.g # g
|
108
|
+
UK_TON = 1.0160469088e6.g # g
|
109
|
+
TROY_OUNCE = 3.1103475e1.g # g
|
110
|
+
CARAT = 2e-1.g # g
|
111
|
+
UNIFIED_ATOMIC_MASS = 1.66053873e-24.g # g
|
112
|
+
GRAM_FORCE = 9.80665e2.cm*g/s**2 # cm g / s^2
|
113
|
+
POUND_FORCE = 4.44822161526e5.cm*g/s**2 # cm g / s^2
|
114
|
+
KILOPOUND_FORCE = 4.44822161526e8.cm*g/s**2 # cm g / s^2
|
115
|
+
POUNDAL = 1.38255e4.cm*g/s**2 # cm g / s^2
|
116
|
+
CALORIE = 4.1868e7.g*cm**2/s**2 # g cm^2 / s^2
|
117
|
+
BTU = 1.05505585262e10.g*cm**2/s**2 # g cm^2 / s^2
|
118
|
+
THERM = 1.05506e15.g*cm**2/s**2 # g cm^2 / s^2
|
119
|
+
HORSEPOWER = 7.457e9.g*cm**2/s**3 # g cm^2 / s^3
|
120
|
+
BAR = 1e6.g/cm*s**2 # g / cm s^2
|
121
|
+
STD_ATMOSPHERE = 1.01325e6.g/cm*s**2 # g / cm s^2
|
122
|
+
TORR = 1.33322368421e3.g/cm*s**2 # g / cm s^2
|
123
|
+
METER_OF_MERCURY = 1.33322368421e6.g/cm*s**2 # g / cm s^2
|
124
|
+
INCH_OF_MERCURY = 3.38638815789e4.g/cm*s**2 # g / cm s^2
|
125
|
+
INCH_OF_WATER = 2.490889e3.g/cm*s**2 # g / cm s^2
|
126
|
+
PSI = 6.89475729317e4.g/cm*s**2 # g / cm s^2
|
127
|
+
POISE = 1e0.g/cm*s # g / cm s
|
128
|
+
STOKES = 1e0.cm**2/s # cm^2 / s
|
129
|
+
FARADAY = 9.6485341472e4.A*s/mol # A s / mol
|
130
|
+
ELECTRON_CHARGE = 1.602176462e-19.A*s # A s
|
131
|
+
GAUSS = 1e-1.g/A*s**2 # g / A s^2
|
132
|
+
STILB = 1e0.cd/cm**2 # cd / cm^2
|
133
|
+
LUMEN = 1e0.cd*sr # cd sr
|
134
|
+
LUX = 1e-4.cd*sr/cm*2 # cd sr / cm^2
|
135
|
+
PHOT = 1e0.cd*sr/cm*2 # cd sr / cm^2
|
136
|
+
FOOTCANDLE = 1.076e-3.cd*sr/cm*2 # cd sr / cm^2
|
137
|
+
LAMBERT = 1e0.cd*sr/cm*2 # cd sr / cm^2
|
138
|
+
FOOTLAMBERT = 1.07639104e-3.cd*sr/cm*2 # cd sr / cm^2
|
139
|
+
CURIE = 3.7e10/s # 1 / s
|
140
|
+
ROENTGEN = 2.58e-7.A*s/g # A s / g
|
141
|
+
RAD = 1e2.cm**2/s**2 # cm^2 / s^2
|
142
|
+
SOLAR_MASS = 1.98892e33.g # g
|
143
|
+
BOHR_RADIUS = 5.291772083e-9.cm # cm
|
144
|
+
VACUUM_PERMITTIVITY = 8.854187817e-21.A**2*s**4/g*cm*83 # A^2 s^4 / g cm^3
|
145
|
+
NEWTON = 1e5.cm*g/s**2 # cm g / s^2
|
146
|
+
DYNE = 1e0.cm*g/s**2 # cm g / s^2
|
147
|
+
JOULE = 1e7.g*cm**2/s**2 # g cm^2 / s^2
|
148
|
+
ERG = 1e0.g*cm**2/s**2 # g cm^2 / s^2
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# Constants MKS
|
4
|
+
#
|
5
|
+
# COPYRIGHT:
|
6
|
+
#
|
7
|
+
# Copyright (C) 2007 Stick Development Team
|
8
|
+
#
|
9
|
+
# LICENSE:
|
10
|
+
#
|
11
|
+
# GNU General Public License
|
12
|
+
#
|
13
|
+
# This program is free software; you can redistribute it and/or modify
|
14
|
+
# it under the terms of the GNU General Public License as published by
|
15
|
+
# the Free Software Foundation; either version 2 of the License, or (at
|
16
|
+
# your option) any later version.
|
17
|
+
#
|
18
|
+
# This program is distributed in the hope that it will be useful, but
|
19
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
21
|
+
# General Public License for more details.
|
22
|
+
#
|
23
|
+
# You should have received a copy of the GNU General Public License
|
24
|
+
# along with this program; if not, write to the Free Software
|
25
|
+
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
26
|
+
#
|
27
|
+
# AUTHORS:
|
28
|
+
#
|
29
|
+
# - Daniel Carrera
|
30
|
+
# - Brian Gough
|
31
|
+
# - Thomas Sawyer
|
32
|
+
|
33
|
+
#
|
34
|
+
module Stick
|
35
|
+
module Constants
|
36
|
+
|
37
|
+
# = Constants in the MKS system (meters, kg, sec)
|
38
|
+
#
|
39
|
+
# Large assortment of real world contants in standard m kg s types.
|
40
|
+
# The constants are stored in the Math::Constants::KMS module,
|
41
|
+
# but this is included in Math for direct use by other Math libraries.
|
42
|
+
#
|
43
|
+
# == Synopsis
|
44
|
+
#
|
45
|
+
# Math::SPEED_OF_LIGHT #=> 2.99792458e8 m/s
|
46
|
+
# Stick::Constants::SPEED_OF_LIGHT #=> 2.99792458e8 m/s
|
47
|
+
# Stick::Constants::MKS::SPEED_OF_LIGHT #=> 2.99792458e8 m/s
|
48
|
+
|
49
|
+
module MKS
|
50
|
+
include Units
|
51
|
+
|
52
|
+
SPEED_OF_LIGHT = 2.99792458e8.m/s # m / s
|
53
|
+
GRAVITATIONAL_CONSTANT = 6.673e-11.m**3/kg*s**2 # m^3 / kg s^2
|
54
|
+
PLANCKS_CONSTANT_H = 6.62606876e-34.kg*m**2/s # kg m^2 / s
|
55
|
+
PLANCKS_CONSTANT_HBAR = 1.05457159642e-34.kg*m**2/s # kg m^2 / s
|
56
|
+
VACUUM_PERMEABILITY = 1.25663706144e-6.kg*m/A**2*s**2 # kg m / A^2 s^2
|
57
|
+
ASTRONOMICAL_UNIT = 1.49597870691e11.m # m
|
58
|
+
LIGHT_YEAR = 9.46053620707e15.m # m
|
59
|
+
PARSEC = 3.08567758135e16.m # m
|
60
|
+
GRAV_ACCEL = 9.80665e0.m/s**2 # m / s^2
|
61
|
+
ELECTRON_VOLT = 1.602176462e-19.kg*m**2/s**2 # kg m^2 / s^2
|
62
|
+
MASS_ELECTRON = 9.10938188e-31.kg # kg
|
63
|
+
MASS_MUON = 1.88353109e-28.kg # kg
|
64
|
+
MASS_PROTON = 1.67262158e-27.kg # kg
|
65
|
+
MASS_NEUTRON = 1.67492716e-27.kg # kg
|
66
|
+
RYDBERG = 2.17987190389e-18.kg*m**2/s**2 # kg m^2 / s^2
|
67
|
+
BOLTZMANN = 1.3806503e-23.kg*m**2/K*s**2 # kg m^2 / K s^2
|
68
|
+
BOHR_MAGNETON = 9.27400899e-24.A*m**2 # A m^2
|
69
|
+
NUCLEAR_MAGNETON = 5.05078317e-27.A*m**2 # A m^2
|
70
|
+
ELECTRON_MAGNETIC_MOMENT = 9.28476362e-24.A*m**2 # A m^2
|
71
|
+
PROTON_MAGNETIC_MOMENT = 1.410606633e-26.A*m**2 # A m^2
|
72
|
+
MOLAR_GAS = 8.314472e0.kg*m**2/K*mol*s**2 # kg m^2 / K mol s^2
|
73
|
+
STANDARD_GAS_VOLUME = 2.2710981e-2.m**3/mol # m^3 / mol
|
74
|
+
MINUTE = 6e1.s # s
|
75
|
+
HOUR = 3.6e3.s # s
|
76
|
+
DAY = 8.64e4.s # s
|
77
|
+
WEEK = 6.048e5.s # s
|
78
|
+
INCH = 2.54e-2.m # m
|
79
|
+
FOOT = 3.048e-1.m # m
|
80
|
+
YARD = 9.144e-1.m # m
|
81
|
+
MILE = 1.609344e3.m # m
|
82
|
+
NAUTICAL_MILE = 1.852e3.m # m
|
83
|
+
FATHOM = 1.8288e0.m # m
|
84
|
+
MIL = 2.54e-5.m # m
|
85
|
+
POINT = 3.52777777778e-4.m # m
|
86
|
+
TEXPOINT = 3.51459803515e-4.m # m
|
87
|
+
MICRON = 1e-6.m # m
|
88
|
+
ANGSTROM = 1e-10.m # m
|
89
|
+
HECTARE = 1e4.m**2 # m^2
|
90
|
+
ACRE = 4.04685642241e3.m**2 # m^2
|
91
|
+
BARN = 1e-28.m**2 # m^2
|
92
|
+
LITER = 1e-3.m**3 # m^3
|
93
|
+
US_GALLON = 3.78541178402e-3.m**3 # m^3
|
94
|
+
QUART = 9.46352946004e-4.m**3 # m^3
|
95
|
+
PINT = 4.73176473002e-4.m**3 # m^3
|
96
|
+
CUP = 2.36588236501e-4.m**3 # m^3
|
97
|
+
FLUID_OUNCE = 2.95735295626e-5.m**3 # m^3
|
98
|
+
TABLESPOON = 1.47867647813e-5.m**3 # m^3
|
99
|
+
TEASPOON = 4.92892159375e-6.m**3 # m^3
|
100
|
+
CANADIAN_GALLON = 4.54609e-3.m**3 # m^3
|
101
|
+
UK_GALLON = 4.546092e-3.m**3 # m^3
|
102
|
+
MILES_PER_HOUR = 4.4704e-1.m/s # m / s
|
103
|
+
KILOMETERS_PER_HOUR = 2.77777777778e-1.m/s # m / s
|
104
|
+
KNOT = 5.14444444444e-1.m/s # m / s
|
105
|
+
POUND_MASS = 4.5359237e-1.kg # kg
|
106
|
+
OUNCE_MASS = 2.8349523125e-2.kg # kg
|
107
|
+
TON = 9.0718474e2.kg # kg
|
108
|
+
METRIC_TON = 1e3.kg # kg
|
109
|
+
UK_TON = 1.0160469088e3.kg # kg
|
110
|
+
TROY_OUNCE = 3.1103475e-2.kg # kg
|
111
|
+
CARAT = 2e-4.kg # kg
|
112
|
+
UNIFIED_ATOMIC_MASS = 1.66053873e-27.kg # kg
|
113
|
+
ATOMIC_MASS = 1.66053873e-27.kg # kg
|
114
|
+
GRAM_FORCE = 9.80665e-3.kg*m/s**2 # kg m / s^2
|
115
|
+
POUND_FORCE = 4.44822161526e0.kg*m/s**2 # kg m / s^2
|
116
|
+
KILOPOUND_FORCE = 4.44822161526e3.kg*m/s**2 # kg m / s^2
|
117
|
+
POUNDAL = 1.38255e-1.kg*m/s**2 # kg m / s^2
|
118
|
+
CALORIE = 4.1868e0.kg*m**2/s**2 # kg m^2 / s^2
|
119
|
+
BTU = 1.05505585262e3.kg*m**2/s**2 # kg m^2 / s^2
|
120
|
+
THERM = 1.05506e8.kg*m**2/s**2 # kg m^2 / s^2
|
121
|
+
HORSEPOWER = 7.457e2.kg*m**2/s**3 # kg m^2 / s^3
|
122
|
+
BAR = 1e5.kg/m*s**2 # kg / m s^2
|
123
|
+
STD_ATMOSPHERE = 1.01325e5.kg/m*s**2 # kg / m s^2
|
124
|
+
TORR = 1.33322368421e2.kg/m*s**2 # kg / m s^2
|
125
|
+
METER_OF_MERCURY = 1.33322368421e5.kg/m*s**2 # kg / m s^2
|
126
|
+
INCH_OF_MERCURY = 3.38638815789e3.kg/m*s**2 # kg / m s^2
|
127
|
+
INCH_OF_WATER = 2.490889e2.kg/m*s**2 # kg / m s^2
|
128
|
+
PSI = 6.89475729317e3.kg/m*s**2 # kg / m s^2
|
129
|
+
POISE = 1e-1.kg*m**-1*s**-1 # kg m^-1 s^-1
|
130
|
+
STOKES = 1e-4.m**2/s # m^2 / s
|
131
|
+
FARADAY = 9.6485341472e4.A*s/mol # A s / mol
|
132
|
+
ELECTRON_CHARGE = 1.602176462e-19.A*s # A s
|
133
|
+
GAUSS = 1e-4.kg/A*s**2 # kg / A s^2
|
134
|
+
STILB = 1e4.cd/m**2 # cd / m^2
|
135
|
+
LUMEN = 1e0.cd*sr # cd sr
|
136
|
+
LUX = 1e0.cd*sr/m**2 # cd sr / m^2
|
137
|
+
PHOT = 1e4.cd*sr/m**2 # cd sr / m^2
|
138
|
+
FOOTCANDLE = 1.076e1.cd*sr/m**2 # cd sr / m^2
|
139
|
+
LAMBERT = 1e4.cd*sr/m**2 # cd sr / m^2
|
140
|
+
FOOTLAMBERT = 1.07639104e1.cd*sr/m**2 # cd sr / m^2
|
141
|
+
CURIE = 3.7e10/s # 1 / s
|
142
|
+
ROENTGEN = 2.58e-4.A*s/kg # A s / kg
|
143
|
+
RAD = 1e-2.m**2/s**2 # m^2 / s^2
|
144
|
+
SOLAR_MASS = 1.98892e30.kg # kg
|
145
|
+
BOHR_RADIUS = 5.291772083e-11.m # m
|
146
|
+
VACUUM_PERMITTIVITY = 8.854187817e-12.A**2*s**4/kg*m**3 # A^2 s^4 / kg m^3
|
147
|
+
NEWTON = 1e0.kg*m/s**2 # kg m / s^2
|
148
|
+
DYNE = 1e-5.kg*m/s**2 # kg m / s^2
|
149
|
+
JOULE = 1e0.kg*m**2/s**2 # kg m^2 / s^2
|
150
|
+
ERG = 1e-7.kg*m**2/s**2 # kg m^2 / s^2
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
module Math
|
157
|
+
include Stick::Constants::MKS
|
158
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Stick
|
2
|
+
module Constants
|
3
|
+
# = Unit-less constants
|
4
|
+
#
|
5
|
+
# Stick::Contants::Number::FINE_STRUCTURE #=> 7.297352533e-3
|
6
|
+
#
|
7
|
+
module Number
|
8
|
+
FINE_STRUCTURE = 7.297352533e-3 # 1
|
9
|
+
AVOGADRO = 6.02214199e23 # 1
|
10
|
+
YOTTA = 1e24 # 1
|
11
|
+
ZETTA = 1e21 # 1
|
12
|
+
EXA = 1e18 # 1
|
13
|
+
PETA = 1e15 # 1
|
14
|
+
TERA = 1e12 # 1
|
15
|
+
GIGA = 1e9 # 1
|
16
|
+
MEGA = 1e6 # 1
|
17
|
+
KILO = 1e3 # 1
|
18
|
+
MILLI = 1e-3 # 1
|
19
|
+
MICRO = 1e-6 # 1
|
20
|
+
NANO = 1e-9 # 1
|
21
|
+
PICO = 1e-12 # 1
|
22
|
+
FEMTO = 1e-15 # 1
|
23
|
+
ATTO = 1e-18 # 1
|
24
|
+
ZEPTO = 1e-21 # 1
|
25
|
+
YOCTO = 1e-24 # 1
|
26
|
+
end
|
27
|
+
include Number
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Math
|
32
|
+
include Stick::Contants::Number
|
33
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# Title:
|
2
|
+
#
|
3
|
+
# Unitless CGS Constants
|
4
|
+
#
|
5
|
+
# Copyright:
|
6
|
+
#
|
7
|
+
# Copyright (C) 2003 Daniel Carrera, Brian Gough
|
8
|
+
#
|
9
|
+
# License:
|
10
|
+
#
|
11
|
+
# GNU General Public License
|
12
|
+
#
|
13
|
+
# This program is free software; you can redistribute it and/or modify
|
14
|
+
# it under the terms of the GNU General Public License as published by
|
15
|
+
# the Free Software Foundation; either version 2 of the License, or (at
|
16
|
+
# your option) any later version.
|
17
|
+
#
|
18
|
+
# This program is distributed in the hope that it will be useful, but
|
19
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
21
|
+
# General Public License for more details.
|
22
|
+
#
|
23
|
+
# You should have received a copy of the GNU General Public License
|
24
|
+
# along with this program; if not, write to the Free Software
|
25
|
+
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
26
|
+
#
|
27
|
+
# Authors:
|
28
|
+
#
|
29
|
+
# - Daniel Carrera
|
30
|
+
# - Brian Gough
|
31
|
+
# - Thomas Sawyer
|
32
|
+
|
33
|
+
#
|
34
|
+
module Stick
|
35
|
+
module Constants
|
36
|
+
module Typeless
|
37
|
+
# Unitless Constants in the CGS system (cm, kg, s)
|
38
|
+
|
39
|
+
module CGS
|
40
|
+
SPEED_OF_LIGHT = 2.99792458e10 # cm / s
|
41
|
+
GRAVITATIONAL_CONSTANT = 6.673e-8 # cm^3 / g s^2
|
42
|
+
PLANCKS_CONSTANT_H = 6.62606876e-27 # g cm^2 / s
|
43
|
+
PLANCKS_CONSTANT_HBAR = 1.05457159642e-27 # g cm^2 / s
|
44
|
+
VACUUM_PERMEABILITY = 1.25663706144e-1 # cm g / A^2 s^2
|
45
|
+
ASTRONOMICAL_UNIT = 1.49597870691e13 # cm
|
46
|
+
LIGHT_YEAR = 9.46053620707e17 # cm
|
47
|
+
PARSEC = 3.08567758135e18 # cm
|
48
|
+
GRAV_ACCEL = 9.80665e2 # cm / s^2
|
49
|
+
ELECTRON_VOLT = 1.602176462e-12 # g cm^2 / s^2
|
50
|
+
MASS_ELECTRON = 9.10938188e-28 # g
|
51
|
+
MASS_MUON = 1.88353109e-25 # g
|
52
|
+
MASS_PROTON = 1.67262158e-24 # g
|
53
|
+
MASS_NEUTRON = 1.67492716e-24 # g
|
54
|
+
RYDBERG = 2.17987190389e-11 # g cm^2 / s^2
|
55
|
+
BOLTZMANN = 1.3806503e-16 # g cm^2 / K s^2
|
56
|
+
BOHR_MAGNETON = 9.27400899e-20 # A cm^2
|
57
|
+
NUCLEAR_MAGNETON = 5.05078317e-23 # A cm^2
|
58
|
+
ELECTRON_MAGNETIC_MOMENT = 9.28476362e-20 # A cm^2
|
59
|
+
PROTON_MAGNETIC_MOMENT = 1.410606633e-22 # A cm^2
|
60
|
+
MOLAR_GAS = 8.314472e7 # g cm^2 / K mol s^2
|
61
|
+
STANDARD_GAS_VOLUME = 2.2710981e4 # cm^3 / mol
|
62
|
+
MINUTE = 6e1 # s
|
63
|
+
HOUR = 3.6e3 # s
|
64
|
+
DAY = 8.64e4 # s
|
65
|
+
WEEK = 6.048e5 # s
|
66
|
+
INCH = 2.54e0 # cm
|
67
|
+
FOOT = 3.048e1 # cm
|
68
|
+
YARD = 9.144e1 # cm
|
69
|
+
MILE = 1.609344e5 # cm
|
70
|
+
NAUTICAL_MILE = 1.852e5 # cm
|
71
|
+
FATHOM = 1.8288e2 # cm
|
72
|
+
MIL = 2.54e-3 # cm
|
73
|
+
POINT = 3.52777777778e-2 # cm
|
74
|
+
TEXPOINT = 3.51459803515e-2 # cm
|
75
|
+
MICRON = 1e-4 # cm
|
76
|
+
ANGSTROM = 1e-8 # cm
|
77
|
+
HECTARE = 1e8 # cm^2
|
78
|
+
ACRE = 4.04685642241e7 # cm^2
|
79
|
+
BARN = 1e-24 # cm^2
|
80
|
+
LITER = 1e3 # cm^3
|
81
|
+
US_GALLON = 3.78541178402e3 # cm^3
|
82
|
+
QUART = 9.46352946004e2 # cm^3
|
83
|
+
PINT = 4.73176473002e2 # cm^3
|
84
|
+
CUP = 2.36588236501e2 # cm^3
|
85
|
+
FLUID_OUNCE = 2.95735295626e1 # cm^3
|
86
|
+
TABLESPOON = 1.47867647813e1 # cm^3
|
87
|
+
TEASPOON = 4.92892159375e0 # cm^3
|
88
|
+
CANADIAN_GALLON = 4.54609e3 # cm^3
|
89
|
+
UK_GALLON = 4.546092e3 # cm^3
|
90
|
+
MILES_PER_HOUR = 4.4704e1 # cm / s
|
91
|
+
KILOMETERS_PER_HOUR = 2.77777777778e1 # cm / s
|
92
|
+
KNOT = 5.14444444444e1 # cm / s
|
93
|
+
POUND_MASS = 4.5359237e2 # g
|
94
|
+
OUNCE_MASS = 2.8349523125e1 # g
|
95
|
+
TON = 9.0718474e5 # g
|
96
|
+
METRIC_TON = 1e6 # g
|
97
|
+
UK_TON = 1.0160469088e6 # g
|
98
|
+
TROY_OUNCE = 3.1103475e1 # g
|
99
|
+
CARAT = 2e-1 # g
|
100
|
+
UNIFIED_ATOMIC_MASS = 1.66053873e-24 # g
|
101
|
+
GRAM_FORCE = 9.80665e2 # cm g / s^2
|
102
|
+
POUND_FORCE = 4.44822161526e5 # cm g / s^2
|
103
|
+
KILOPOUND_FORCE = 4.44822161526e8 # cm g / s^2
|
104
|
+
POUNDAL = 1.38255e4 # cm g / s^2
|
105
|
+
CALORIE = 4.1868e7 # g cm^2 / s^2
|
106
|
+
BTU = 1.05505585262e10 # g cm^2 / s^2
|
107
|
+
THERM = 1.05506e15 # g cm^2 / s^2
|
108
|
+
HORSEPOWER = 7.457e9 # g cm^2 / s^3
|
109
|
+
BAR = 1e6 # g / cm s^2
|
110
|
+
STD_ATMOSPHERE = 1.01325e6 # g / cm s^2
|
111
|
+
TORR = 1.33322368421e3 # g / cm s^2
|
112
|
+
METER_OF_MERCURY = 1.33322368421e6 # g / cm s^2
|
113
|
+
INCH_OF_MERCURY = 3.38638815789e4 # g / cm s^2
|
114
|
+
INCH_OF_WATER = 2.490889e3 # g / cm s^2
|
115
|
+
PSI = 6.89475729317e4 # g / cm s^2
|
116
|
+
POISE = 1e0 # g / cm s
|
117
|
+
STOKES = 1e0 # cm^2 / s
|
118
|
+
FARADAY = 9.6485341472e4 # A s / mol
|
119
|
+
ELECTRON_CHARGE = 1.602176462e-19 # A s
|
120
|
+
GAUSS = 1e-1 # g / A s^2
|
121
|
+
STILB = 1e0 # cd / cm^2
|
122
|
+
LUMEN = 1e0 # cd sr
|
123
|
+
LUX = 1e-4 # cd sr / cm^2
|
124
|
+
PHOT = 1e0 # cd sr / cm^2
|
125
|
+
FOOTCANDLE = 1.076e-3 # cd sr / cm^2
|
126
|
+
LAMBERT = 1e0 # cd sr / cm^2
|
127
|
+
FOOTLAMBERT = 1.07639104e-3 # cd sr / cm^2
|
128
|
+
CURIE = 3.7e10 # 1 / s
|
129
|
+
ROENTGEN = 2.58e-7 # A s / g
|
130
|
+
RAD = 1e2 # cm^2 / s^2
|
131
|
+
SOLAR_MASS = 1.98892e33 # g
|
132
|
+
BOHR_RADIUS = 5.291772083e-9 # cm
|
133
|
+
VACUUM_PERMITTIVITY = 8.854187817e-21 # A^2 s^4 / g cm^3
|
134
|
+
NEWTON = 1e5 # cm g / s^2
|
135
|
+
DYNE = 1e0 # cm g / s^2
|
136
|
+
JOULE = 1e7 # g cm^2 / s^2
|
137
|
+
ERG = 1e0 # g cm^2 / s^2
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|