Units | Science @ Science @ MentDB Weak
Constants and units
• Physical constants in SI units: CODATA 2022 recommended values (NIST, physics.nist.gov/constants).
• The constants defined by the SI (c, h, e, k, NA...) are exact; the exact derived constants (hbar, sigma, R, F, KJ, RK...) are computed from their definition.
• Use 'const info' to get the unit and the standard uncertainty.
• The older 'constant ...' functions (JScience values, text with the uncertainty and the unit) are kept for compatibility; 'const' gives plain numbers usable in calculations.
• Unit conversion: length, mass, time, temperature, area, volume, speed, force, energy, power, pressure, angle, frequency, data.
• The conversion is computed in decimal (34 digits) and the result is given with 15 significant digits: 1 in = 2.54 cm exactly.
• Computation with units (unit calc): 230 V * 10 A = 2300 W, _h*_c/(500 nm) in eV, with the dimensions checked (8 SI dimensions: m kg s A K mol cd bit).
• The unit symbols are case sensitive (MB = megabyte, mb is unknown). Temperatures: K, degC, degF, degR (the aliases with the degree sign are also accepted). Micro: um, ug, us (or with the micro sign).
• The constants defined by the SI (c, h, e, k, NA...) are exact; the exact derived constants (hbar, sigma, R, F, KJ, RK...) are computed from their definition.
• Use 'const info' to get the unit and the standard uncertainty.
• The older 'constant ...' functions (JScience values, text with the uncertainty and the unit) are kept for compatibility; 'const' gives plain numbers usable in calculations.
• Unit conversion: length, mass, time, temperature, area, volume, speed, force, energy, power, pressure, angle, frequency, data.
• The conversion is computed in decimal (34 digits) and the result is given with 15 significant digits: 1 in = 2.54 cm exactly.
• Computation with units (unit calc): 230 V * 10 A = 2300 W, _h*_c/(500 nm) in eV, with the dimensions checked (8 SI dimensions: m kg s A K mol cd bit).
• The unit symbols are case sensitive (MB = megabyte, mb is unknown). Temperatures: K, degC, degF, degR (the aliases with the degree sign are also accepted). Micro: um, ug, us (or with the micro sign).
const get <name>const info <name>const listconst list <category>unit convert <value> <from> <to>unit calc <expression>unit calc <expression> <unit>unit listunit list <quantity>unit prefix <value> <from> <to>
const get <name>
Description
Get the value of a physical constant (SI unit).
Names (case sensitive):
- universal: c, h, hbar, G, mu0, eps0, Z0, k
- electromagnetic: e, Phi0, G0, KJ, RK, muB, muN
- atomic: me, mp, mn, mmu, u, alpha, Rinf, a0, re, lambdaC, Eh, ge, mue, mup, mec2 (MeV), mpc2 (MeV)
- physicochemical: NA, R, F, sigma, b, c1, c2, Vm, n0, eV
- adopted: g0, atm, dnuCs, Kcd
Get the value of a physical constant (SI unit).
Names (case sensitive):
- universal: c, h, hbar, G, mu0, eps0, Z0, k
- electromagnetic: e, Phi0, G0, KJ, RK, muB, muN
- atomic: me, mp, mn, mmu, u, alpha, Rinf, a0, re, lambdaC, Eh, ge, mue, mup, mec2 (MeV), mpc2 (MeV)
- physicochemical: NA, R, F, sigma, b, c1, c2, Vm, n0, eV
- adopted: g0, atm, dnuCs, Kcd
Parameters
name: The name of the constant - String - required
name: The name of the constant - String - required
Examples (10)
admin
const get "G"
mentdb
6.6743E-11
admin
const get "NA"
mentdb
6.02214076E23
Planck constant
admin
const get "h"
mentdb
6.62607015E-34
Electron mass
admin
const get "me"
mentdb
9.1093837139E-31
Standard gravity (g0)
admin
const get "g0"
mentdb
9.80665
Boltzmann constant
admin
const get "k"
mentdb
1.380649E-23
Elementary charge
admin
const get "e"
mentdb
1.602176634E-19
Gas constant
admin
const get "R"
mentdb
8.31446261815324
Use in an expression: k T at 300 K in eV
admin
unit calc "_k * 300 K" "eV"
mentdb
0.0258519997864355
Unknown constant: error
admin
const get "foo"
mentdb
Sorry, an error appears (unknown constant 'foo' (see 'const list')).
const info <name>
Description
Get a physical constant as a JSON object: name, description, value, standard uncertainty, exact, unit, category
Get a physical constant as a JSON object: name, description, value, standard uncertainty, exact, unit, category
Parameters
name: The name of the constant - String - required
name: The name of the constant - String - required
Examples (4)
Gravitational constant (measured, with an uncertainty)
admin
const info "G"
mentdb
{"name": "G", "description": "Newtonian constant of gravitation", "value": 6.6743E-11, "uncertainty": 1.5E-15, "exact": false, "unit": "m^3 kg^-1 s^-2", "category": "universal"}
Speed of light
admin
const info "c"
mentdb
{"name": "c", "description": "speed of light in vacuum", "value": 2.99792458E8, "uncertainty": 0, "exact": true, "unit": "m s^-1", "category": "universal"}
Electron mass
admin
const info "me"
mentdb
{"name": "me", "description": "electron mass", "value": 9.1093837139E-31, "uncertainty": 2.8E-40, "exact": false, "unit": "kg", "category": "atomic"}
Fine-structure constant
admin
const info "alpha"
mentdb
{"name": "alpha", "description": "fine-structure constant", "value": 0.0072973525643, "uncertainty": 1.1E-12, "exact": false, "unit": "", "category": "atomic"}
const list
Description
List all the physical constants (JSON array of objects, same fields as 'const info')
List all the physical constants (JSON array of objects, same fields as 'const info')
Examples (1)
admin
const list
mentdb
[ {"name": "c", "description": "speed of light in vacuum", "value": 2.99792458E8, "uncertainty": 0, "exact": true, "unit": "m s^-1", "category": "universal"}, {"name": "h", "description": "Planck constant", "value": 6.62607015E-34, "uncertainty": 0, "exact": true, "unit": "J Hz^-1", "category": "universal"}, {"name": "hbar", "description": "reduced Planck constant", "value": 1.0545718176461565E-34, "uncertainty": 0, "exact": true, "unit": "J s", "category": "universal"}, {"name": "G", "description": "Newtonian constant of gravitation", "value": 6.6743E-11, "uncertainty": 1.5E-15, "exact": false, "unit": "m^3 kg^-1 s^-2", "category": "universal"}, {"name": "mu0", "description": "vac ...
const list <category>
Description
List the physical constants of a category: universal, electromagnetic, atomic, physicochemical, adopted
List the physical constants of a category: universal, electromagnetic, atomic, physicochemical, adopted
Parameters
category: The category - String - required
category: The category - String - required
Examples (4)
admin
const list "adopted"
mentdb
[ {"name": "g0", "description": "standard acceleration of gravity", "value": 9.80665, "uncertainty": 0, "exact": true, "unit": "m s^-2", "category": "adopted"}, {"name": "atm", "description": "standard atmosphere", "value": 101325, "uncertainty": 0, "exact": true, "unit": "Pa", "category": "adopted"}, {"name": "dnuCs", "description": "hyperfine transition frequency of Cs-133", "value": 9.19263177E9, "uncertainty": 0, "exact": true, "unit": "Hz", "category": "adopted"}, {"name": "Kcd", "description": "luminous efficacy", "value": 683, "uncertainty": 0, "exact": true, "unit": "lm W^-1", "category": "adopted"} ]
Atomic constants
admin
const list "atomic"
mentdb
[ {"name": "me", "description": "electron mass", "value": 9.1093837139E-31, "uncertainty": 2.8E-40, "exact": false, "unit": "kg", "category": "atomic"}, {"name": "mp", "description": "proton mass", "value": 1.67262192595E-27, "uncertainty": 5.2E-37, "exact": false, "unit": "kg", "category": "atomic"}, {"name": "mn", "description": "neutron mass", "value": 1.67492750056E-27, "uncertainty": 8.5E-37, "exact": false, "unit": "kg", "category": "atomic"}, {"name": "mmu", "description": "muon mass", "value": 1.883531627E-28, "uncertainty": 4.2E-36, "exact": false, "unit": "kg", "category": "atomic"}, {"name": "u", "description": "atomic mass constant (dalton)", "value": 1.66053906892E-27, ...
Universal constants
admin
const list "universal"
mentdb
[ {"name": "c", "description": "speed of light in vacuum", "value": 2.99792458E8, "uncertainty": 0, "exact": true, "unit": "m s^-1", "category": "universal"}, {"name": "h", "description": "Planck constant", "value": 6.62607015E-34, "uncertainty": 0, "exact": true, "unit": "J Hz^-1", "category": "universal"}, {"name": "hbar", "description": "reduced Planck constant", "value": 1.0545718176461565E-34, "uncertainty": 0, "exact": true, "unit": "J s", "category": "universal"}, {"name": "G", "description": "Newtonian constant of gravitation", "value": 6.6743E-11, "uncertainty": 1.5E-15, "exact": false, "unit": "m^3 kg^-1 s^-2", "category": "universal"}, {"name": "mu0", "description": "vac ...
Electromagnetic constants
admin
const list "electromagnetic"
mentdb
[ {"name": "e", "description": "elementary charge", "value": 1.602176634E-19, "uncertainty": 0, "exact": true, "unit": "C", "category": "electromagnetic"}, {"name": "Phi0", "description": "magnetic flux quantum", "value": 2.0678338484619295E-15, "uncertainty": 0, "exact": true, "unit": "Wb", "category": "electromagnetic"}, {"name": "G0", "description": "conductance quantum", "value": 7.748091729863649E-5, "uncertainty": 0, "exact": true, "unit": "S", "category": "electromagnetic"}, {"name": "KJ", "description": "Josephson constant", "value": 4.835978484169836E14, "uncertainty": 0, "exact": true, "unit": "Hz V^-1", "category": "electromagnetic"}, {"name": "RK", "description": "von K ...
unit convert <value> <from> <to>
Description
Convert a value from a unit to another unit of the same quantity
Convert a value from a unit to another unit of the same quantity
Parameters
value: The value - Number - required
from: The unit of the value - String - required
to: The target unit - String - required
value: The value - Number - required
from: The unit of the value - String - required
to: The target unit - String - required
Examples (13)
admin
unit convert 100 "km/h" "m/s"
mentdb
27.7777777777778
admin
unit convert 100 degC degF
mentdb
212
Temperature
admin
unit convert 37 "degC" "degF"
mentdb
98.6
Pressure
admin
unit convert 1 "atm" "Pa"
mentdb
101325
Energy
admin
unit convert 1 "kWh" "J"
mentdb
3600000
Data
admin
unit convert 1 "GiB" "MB"
mentdb
1073.741824
Length: miles to km
admin
unit convert 26.2 "mi" "km"
mentdb
42.1648128
Speed: knots to km/h
admin
unit convert 20 "kn" "km/h"
mentdb
37.04
Temperature: kelvin to degC
admin
unit convert 300 "K" "degC"
mentdb
26.85
Angle: degrees to radians
admin
unit convert 180 "deg" "rad"
mentdb
3.14159265358979
Energy: calories to joules
admin
unit convert 250 "kcal" "kJ"
mentdb
1046
Pressure: bar to psi
admin
unit convert 2.2 "bar" "psi"
mentdb
31.908302300646
Not the same quantity: error
admin
unit convert 1 "m" "kg"
mentdb
Sorry, an error appears (incompatible units: m (length) and kg (mass)).
unit calc <expression>
Description
Compute an expression with units (the result in SI units: N, J, W, Pa, V, ohm... when they match; display format: session variable [_format], as math calc). The units follow the numbers (3 m, 9.81 m/s^2, 2 kohm); a number followed by its unit binds first: 3 m / 2 s = (3 m)/(2 s). Functions: sqrt, abs, sin, cos, tan (angle in rad or deg), exp, ln, log10... Constants: _c, _h, _k, _NA, _G, _e, _me, _R... with their unit (see 'const list'). Variables: [m] (number or quantity: -> "[v]" "3 m/s"). Adding m and s is an error. degC and degF (offset) can only be converted alone: use K in the computations
Compute an expression with units (the result in SI units: N, J, W, Pa, V, ohm... when they match; display format: session variable [_format], as math calc). The units follow the numbers (3 m, 9.81 m/s^2, 2 kohm); a number followed by its unit binds first: 3 m / 2 s = (3 m)/(2 s). Functions: sqrt, abs, sin, cos, tan (angle in rad or deg), exp, ln, log10... Constants: _c, _h, _k, _NA, _G, _e, _me, _R... with their unit (see 'const list'). Variables: [m] (number or quantity: -> "[v]" "3 m/s"). Adding m and s is an error. degC and degF (offset) can only be converted alone: use K in the computations
Parameters
expression: The expression with units (ex: "230 V * 10 A", "_h*_c/(500 nm)", "[m]*9.81 m/s^2") - String - required
expression: The expression with units (ex: "230 V * 10 A", "_h*_c/(500 nm)", "[m]*9.81 m/s^2") - String - required
Examples (12)
admin
unit calc "3 m / 2 s"
mentdb
1.5 m/s
admin
unit calc "_NA*_k"
mentdb
8.31446261815324 J/(K*mol)
Power of a resistor P = U^2 / R
admin
unit calc "(12 V)^2 / (4 ohm)"
mentdb
36 W
Force of gravity on 75 kg
admin
unit calc "75 kg * _g0"
mentdb
735.49875 N
Kinetic energy
admin
unit calc "0.5 * 1200 kg * (100 km/h)^2"
mentdb
462962.962962963 J
Ideal gas: volume of 1 mol at 0 degC and 1 atm
admin
unit calc "1 mol * _R * 273.15 K / (1 atm)"
mentdb
0.0224139695450141 m^3
Energy of a battery of 2000 mAh at 3.7 V
admin
unit calc "2000 mAh * 3.7 V"
mentdb
26640 J
Density in kg/m3
admin
unit calc "2.5 kg / (1 L)"
mentdb
2500 kg/m^3
Speed of a wave: lambda f
admin
unit calc "0.5 m * 440 Hz"
mentdb
220 m/s
Ohm law U = R I
admin
unit calc "4.7 kohm * 2 mA"
mentdb
9.4 V
Pressure under 10 m of water
admin
unit calc "1000 kg/m^3 * _g0 * 10 m"
mentdb
98066.5 Pa
Inconsistent units: error
admin
unit calc "3 m + 2 s"
mentdb
Sorry, an error appears (cannot add m and s (position 10 in '3 m + 2 s')).
unit calc <expression> <unit>
Description
Compute an expression with units and give the result as a number in the target unit (the dimensions must match)
Compute an expression with units and give the result as a number in the target unit (the dimensions must match)
Parameters
expression: The expression with units (ex: "5 V / 2 kohm", "25 degC") - String - required
unit: The target unit (ex: "mA", "km/h", "MeV", "degF") - String - required
expression: The expression with units (ex: "5 V / 2 kohm", "25 degC") - String - required
unit: The target unit (ex: "mA", "km/h", "MeV", "degF") - String - required
Examples (11)
admin
unit calc "_h*_c/(500 nm)" "eV"
mentdb
2.47968396866401
admin
unit calc "60 W * 2 h" "kWh"
mentdb
0.12
Volume of 1 mol of ideal gas in L
admin
unit calc "1 mol * _R * 273.15 K / (1 atm)" "L"
mentdb
22.4139695450141
Wavelength of a photon of 2 eV in nm
admin
unit calc "_h*_c/(2 eV)" "nm"
mentdb
619.920992166001
Consumption: 6 L/100 km in miles per gallon (inverse)
admin
unit calc "100 km / (6 L)" "mi/gal"
mentdb
39.2024305555556
Body temperature
admin
unit calc "98.6 degF" "degC"
mentdb
37
Speed in km/h
admin
unit calc "100 m / (9.58 s)" "km/h"
mentdb
37.5782881002088
Energy of a battery in kWh
admin
unit calc "75 Ah * 12 V" "kWh"
mentdb
0.9
Power of a car in hp
admin
unit calc "110 kW" "hp"
mentdb
147.512429855453
Wavelength of a radio at 100 MHz
admin
unit calc "_c / (100 MHz)" "m"
mentdb
2.99792458
Units not compatible: error
admin
unit calc "3 m" "kg"
mentdb
Sorry, an error appears (incompatible units: the result is in m, not in kg).
unit list
Description
List the quantities and their units (JSON object)
List the quantities and their units (JSON object)
Examples (1)
admin
unit list
mentdb
{ "length": ["m", "km", "cm", "mm", "um", "nm", "pm", "angstrom", "in", "ft", "yd", "mi", "nmi", "au", "ly", "pc"], "mass": ["kg", "g", "mg", "ug", "t", "lb", "oz", "st", "Da"], "time": ["s", "ms", "us", "ns", "min", "h", "d", "week", "yr"], "temperature": ["K", "degC", "degF", "degR"], "area": ["m2", "km2", "cm2", "mm2", "ha", "a", "acre", "ft2", "in2", "mi2"], "volume": ["m3", "L", "mL", "cL", "dL", "cm3", "mm3", "gal", "galUK", "qt", "pt", "floz", "ft3", "in3", "bbl"], "speed": ["m/s", "km/h", "mph", "kn", "ft/s"], "force": ["N", "kN", "mN", "dyn", "kgf", "lbf"], "energy": ["J", "mJ", "kJ", "MJ", "eV", "keV", "MeV", "GeV", "cal", "kcal", "Wh", "kWh", "MWh", "BTU", "erg"] ...
unit list <quantity>
Description
List the units of a quantity with their factor to the SI unit (and the offset for the temperatures)
List the units of a quantity with their factor to the SI unit (and the offset for the temperatures)
Parameters
quantity: The quantity (length, mass, time, temperature, area, volume, speed, force, energy, power, pressure, angle, frequency, data) - String - required
quantity: The quantity (length, mass, time, temperature, area, volume, speed, force, energy, power, pressure, angle, frequency, data) - String - required
Examples (4)
admin
unit list "temperature"
mentdb
{"quantity": "temperature", "si": "K", "units": [ {"unit": "K", "name": "kelvin", "to_si": 1}, {"unit": "degC", "name": "degree Celsius", "to_si": 1, "offset_si": 273.15, "aliases": ["°C"]}, {"unit": "degF", "name": "degree Fahrenheit", "to_si": 0.555555555555556, "offset_si": 255.372222222222, "aliases": ["°F"]}, {"unit": "degR", "name": "degree Rankine", "to_si": 0.555555555555556, "aliases": ["°R"]} ]}
Units of pressure
admin
unit list "pressure"
mentdb
{"quantity": "pressure", "si": "Pa", "units": [ {"unit": "Pa", "name": "pascal", "to_si": 1}, {"unit": "hPa", "name": "hectopascal", "to_si": 100}, {"unit": "kPa", "name": "kilopascal", "to_si": 1000}, {"unit": "MPa", "name": "megapascal", "to_si": 1000000}, {"unit": "bar", "name": "bar", "to_si": 100000}, {"unit": "mbar", "name": "millibar", "to_si": 100}, {"unit": "atm", "name": "standard atmosphere", "to_si": 101325}, {"unit": "mmHg", "name": "millimetre of mercury", "to_si": 133.322387415}, {"unit": "torr", "name": "torr", "to_si": 133.322368421053}, {"unit": "psi", "name": "pound per square inch", "to_si": 6894.75729316836}, {"unit": "inHg", "name": "inch of mercur ...
Units of energy
admin
unit list "energy"
mentdb
{"quantity": "energy", "si": "J", "units": [ {"unit": "J", "name": "joule", "to_si": 1}, {"unit": "mJ", "name": "millijoule", "to_si": 0.001}, {"unit": "kJ", "name": "kilojoule", "to_si": 1000}, {"unit": "MJ", "name": "megajoule", "to_si": 1000000}, {"unit": "eV", "name": "electronvolt", "to_si": 1.602176634E-19}, {"unit": "keV", "name": "kiloelectronvolt", "to_si": 1.602176634E-16}, {"unit": "MeV", "name": "megaelectronvolt", "to_si": 1.602176634E-13}, {"unit": "GeV", "name": "gigaelectronvolt", "to_si": 1.602176634E-10}, {"unit": "cal", "name": "calorie (thermochemical)", "to_si": 4.184}, {"unit": "kcal", "name": "kilocalorie (thermochemical)", "to_si": 4184}, {"unit" ...
Unknown quantity: error
admin
unit list "foo"
mentdb
Sorry, an error appears (unknown quantity 'foo' (length, mass, time, temperature, area, volume, speed, force, energy, power, pressure, angle, frequency, data)).
unit prefix <value> <from> <to>
Description
Change the SI prefix of a value (exact): Q R Y Z E P T G M k h da none d c m u n p f a z y r q (case sensitive; the micro sign is also accepted for u)
Change the SI prefix of a value (exact): Q R Y Z E P T G M k h da none d c m u n p f a z y r q (case sensitive; the micro sign is also accepted for u)
Parameters
value: The value - Number - required
from: The prefix of the value - String - required
to: The target prefix - String - required
value: The value - Number - required
from: The prefix of the value - String - required
to: The target prefix - String - required
Examples (6)
admin
unit prefix 1500 k M
mentdb
1.5
admin
unit prefix 2.5 G none
mentdb
2500000000
Nanometers to meters
admin
unit prefix 532 n none
mentdb
0.000000532
Kilo to milli
admin
unit prefix 2.5 k m
mentdb
2500000
Micro to nano
admin
unit prefix 0.47 u n
mentdb
470
Without prefix to mega
admin
unit prefix 2500000 none M
mentdb
2.5
