001/*
002 * JScience - Java(TM) Tools and Libraries for the Advancement of Sciences.
003 * Copyright (C) 2006 - JScience (http://jscience.org/)
004 * All rights reserved.
005 * 
006 * Permission to use, copy, modify, and distribute this software is
007 * freely granted, provided that this notice is preserved.
008 */
009package org.jscience.physics.amount;
010import javolution.lang.MathLib;
011
012import javax.measure.quantity.*;
013import javax.measure.unit.SI;
014import javax.measure.unit.Unit;
015
016/**
017 * <p> This class provides most accurate physical constants measurement;
018 *     the more accurate the constants, the higher the precision 
019 *     of the calculations making use of these constants.</p>
020 *     
021 * <p> Constant names use the full range of Unicode characters and
022 *     are mixed uppercase/lowercase to resemble symbolic names as much
023 *     as possible </p>
024 *
025 * <p> Reference: <a href="http://physics.nist.gov/cuu/Constants/index.html">
026 *     CODATA Internationally recommended values of the Fundamental Physical
027 *     Constants (2002)</a></p>
028 *
029 * @author  <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
030 * @version 3.1, April 7, 2006
031 */
032public final class Constants {
033
034    /**
035     * Holds the standard acceleration due to gravity (approximately equal 
036     * to the acceleration due to gravity on the Earth's surface).
037     * @see <a href="http://en.wikipedia.org/wiki/Acceleration_due_to_gravity">
038     *      Wikipedia: Acceleration due to gravity</a>
039     */
040    public final static Amount<Acceleration> g = 
041        Amount.valueOf(980665, SI.METRES_PER_SQUARE_SECOND).divide(100000); 
042
043    /**
044     * Holds the electron rest mass.
045     */
046    public final static Amount<Mass> me = 
047        Amount.valueOf(9.1093826E-31, 0.0000016E-31, SI.KILOGRAM);
048
049    /**
050     * Holds the proton rest mass.
051     */
052    public final static Amount<Mass> mp 
053            = Amount.valueOf(1.67262171E-27, 0.00000029E-27, SI.KILOGRAM);
054
055    /**
056     * Holds the neutron rest mass.
057     */
058    public final static Amount<Mass> mn 
059    = Amount.valueOf(1.67492728E-27, 0.00000029E-27, SI.KILOGRAM);
060
061    /**
062     * Holds the deuteron rest mass.
063     */
064    public final static Amount<Mass> md 
065    = Amount.valueOf(3.34358335E-27, 0.00000057E-27, SI.KILOGRAM);
066
067    /**
068     * Holds the muon rest mass.
069     */
070    public final static Amount<Mass> mμ 
071    = Amount.valueOf(1.88353140E-28, 0.00000033E-28, SI.KILOGRAM);
072
073    /**
074     * Holds the ratio of the circumference of a circle to its diameter.
075     */
076    public final static Amount<Dimensionless> π = Amount.valueOf(MathLib.PI, Unit.ONE);
077
078    /**
079     * Holds {@link #π}/2.
080     */
081    public final static Amount<Dimensionless> half_π = Amount.valueOf(MathLib.HALF_PI, Unit.ONE);
082
083    /**
084     * Holds 2·{@link #π}.
085     */
086    public final static Amount<Dimensionless> two_π = Amount.valueOf(MathLib.TWO_PI, Unit.ONE);
087
088    /**
089     * Holds 4·{@link #π}.
090     */
091    public final static Amount<Dimensionless> four_π = Amount.valueOf(12.566370614359172953850573533118, Unit.ONE);
092
093    /**
094     * Holds {@link #π}².
095     */
096    public final static Amount<Dimensionless> π_square = Amount.valueOf(9.8696044010893586188344909998762, Unit.ONE);
097
098    /**
099     * Holds the speed of light in vacuum (exact).
100     */
101    public final static Amount<Velocity>  c = Amount.valueOf(299792458, SI.METRES_PER_SECOND);
102    
103    /**
104     * Holds {@link #c}².
105     */
106    public final static Amount<?> c_square = 
107        Amount.valueOf(299792458L * 299792458L, SI.METRES_PER_SECOND.pow(2));
108
109    /**
110     * Holds the Boltzmann constant.
111     * @see <a href="http://en.wikipedia.org/wiki/Boltzmanns_constant">
112     *      Wikipedia: Boltzmann constant</a>
113     */
114    public final static Amount<?> k = Amount.valueOf(
115        1.3806505E-23, 0.0000024E-23, SI.JOULE.divide(SI.KELVIN));
116
117    /**
118     * Holds the Planck constant.
119     * @see <a href="http://en.wikipedia.org/wiki/Plank%27s_constant">
120     *      Wikipedia: Plank's constant</a>
121     */
122    public final static Amount<?> ℎ = Amount.valueOf(
123        6.6260693E-34, 0.0000011E-34, SI.JOULE.times(SI.SECOND));
124
125    /**
126     * Holds the Planck constant over 2π.
127     */
128    public final static Amount<?> ℏ = ℎ.divide(two_π);
129
130    /**
131     * Holds the elementary charge (positron charge).
132     * @see <a href="http://en.wikipedia.org/wiki/Elementary_charge">
133     *      Wikipedia: Elementary Charge</a>
134     */
135    public final static Amount<ElectricCharge> e =
136        Amount.valueOf(
137            1.60217653E-19, 0.00000014E-19, SI.COULOMB);
138
139    /**
140     * Holds the permeability of vacuum or magnetic constant.
141     * @see <a href="http://en.wikipedia.org/wiki/Permeability_%28electromagnetism%29">
142     *      Wikipedia: Permeability (electromagnetism)</a>
143     */
144    public final static Amount<?> µ0 =  Amount.valueOf(
145            1.2566370614359172953850573533118E-6,
146            SI.NEWTON.divide(SI.AMPERE.pow(2))); // 4π×10−7 N/A²
147
148    /**
149     * Holds the permittivity of vacuum or electric constant (1/(µ0·c²))
150     * @see <a href="http://en.wikipedia.org/wiki/Permittivity">
151     *      Wikipedia: Permittivity</a>
152     */
153    public final static Amount<?> ε0 = µ0.times(c.pow(2)).inverse();
154
155    /**
156     * Holds the characteristic impedance of vacuum (µ0·c).
157     */
158    public final static Amount<ElectricResistance> Z0 =  µ0.times(c).to(SI.OHM);
159
160    /**
161     * Holds the fine structure constant (e²/(2·ε0·c·h))
162     * @see <a href="http://en.wikipedia.org/wiki/Fine_structure_constant">
163     *      Wikipedia: Fine Structure Constant</a>
164     */
165    public final static Amount<Dimensionless> α
166        = e.pow(2).divide(ε0.times(c).times(ℎ).times(2)).to(Unit.ONE);
167
168    /**
169     * Holds the Newtonian constant of gravitation.
170     * @see <a href="http://en.wikipedia.org/wiki/Gravitational_constant">
171     *      Wikipedia: Gravitational Constant</a>
172     */
173    public final static Amount<?> G = Amount.valueOf(
174        6.6742E-11, 0.001E-11,
175        SI.METRE.pow(3).divide(SI.KILOGRAM).divide(SI.SECOND.pow(2)));
176
177    /**
178     * Holds the Avogadro constant.
179     * @see <a href="http://en.wikipedia.org/wiki/Avogadro%27s_number">
180     *      Wikipedia: Avogadro's number</a>
181     */
182    public final static Amount<?> N = Amount.valueOf(
183        6.0221415E23, 0.0000010E23, Unit.ONE.divide(SI.MOLE));
184
185    /**
186     * Holds the molar gas constant (N·k)
187     * @see <a href="http://en.wikipedia.org/wiki/Gas_constant">
188     *      Wikipedia: Gas constant</a>
189     */
190    public final static Amount<?> R = N.times(k);
191
192    /**
193     * Holds the Faraday constant (N·e)
194     * @see <a href="http://en.wikipedia.org/wiki/Faraday_constant">
195     *      Wikipedia: Faraday constant</a>
196     */
197    public final static Amount<?> F = N.times(e);
198
199    /**
200     * Holds the Stefan-Boltzmann constant ((π²/60)·k<sup>4</sup>/(ℏ³·c²))
201     */
202    public final static Amount<?> σ
203        = π_square.divide(60).times(k.pow(4)).divide(ℏ.pow(3).times(c.pow(2)));
204
205    /**
206     * Holds the unified atomic mass unit (0.001 kg/mol)/N
207     */
208    public final static Amount<Mass> amu
209        =  Amount.valueOf(
210            1E-3, SI.KILOGRAM.divide(SI.MOLE)).divide(N).to(SI.KILOGRAM);
211
212    /**
213     * Holds the Rydberg constant (α²·me·c/2h).
214     * @see <a href="http://en.wikipedia.org/wiki/Rydberg_constant">
215     *      Wikipedia: Rydberg constant</a>
216     */
217    public final static Amount<?> Rinf 
218        // Do not use formala as experimental incertainty is very low. 
219        = Amount.valueOf(10973731.568525, 0.000073, SI.METRE.inverse());
220    
221    /**
222     * Holds the Bohr radius (α/(4π·Rinf))
223     */
224    public final static Amount<Length> a0
225        = α.divide(π.times(Rinf).times(4)).to(SI.METRE);
226
227    /**
228     * Holds the Hartree energy (2Rinf·h·c)
229     */
230    public final static Amount<?> Eh
231        =  Rinf.times(ℎ).times(c).times(2);
232
233    /**
234     * Holds the magnetic flux quantum (h/2e)
235     */
236    public final static Amount<MagneticFlux> Φ0
237        = ℎ.divide(e).divide(2).to(SI.WEBER);
238
239    /**
240     * Holds the conductance quantum (2e²/h)
241     */
242    public final static Amount<ElectricConductance> G0
243        =  e.pow(2).divide(ℎ).times(2).to(ElectricConductance.UNIT);
244
245    /**
246     * Holds the Bohr magneton (ℏ·e/2me)
247     */
248    public final static Amount<?> µB
249        = e.times(ℏ).divide(me).divide(2);
250
251    /**
252     * Holds the nuclear magneton (ℏ·e/2mp)
253     */
254    public final static Amount<?> µN
255        = e.times(ℏ).divide(mp).divide(2);
256
257    /**
258     * Holds the Planck mass (ℏ·c/G)<sup>1/2</sup>
259     */
260   public final static Amount<Mass> mP = ℏ.times(c).divide(G).root(2).to(SI.KILOGRAM);
261
262    /**
263     * Holds the Planck length (ℏ/(mP·c))
264     */
265    public final static Amount<Length> lP = ℏ.divide(mP.times(c)).to(SI.METRE);
266
267    /**
268     * Holds the Planck time (lP/c)
269     */
270    public final static Amount<Duration> tP = lP.divide(c).to(SI.SECOND);
271
272    /**
273     * Default constructor (no derivation allows).
274     */
275    private Constants() {}
276}