Skip to content
Damien Garaud edited this page Apr 29, 2016 · 3 revisions

Scala breeze constant values are taken from The NIST Reference on Constants, Units and Uncertainty (2010), and are in SI units. Selected constants are available directly, the other NIST constants are available via database search.

##Accessing CODATA2010 constants

import breeze.numerics.constants._

Regex versions of the function will return a Vector of a Tuple2 of the matched value names and value. (i.e. val values: Vector[(String, Double)] = Database.value(regex))

Breeze Scipy
a list of values Database.list() ``
specific value Database.value(string: String) value(key)
(value by regex) Database.value(regex: Regex) i.e. Database.value("""regex string""".r)
uncertainty Database.uncertainty(string: String) precision(key)
(uncertainty by regex) Database.uncertainty (regex: Regex)
unit Database.unit (string: String) unit (key)
(unit by regex) Database.unit (regex: Regex)

##Accessing selected constants directly import breeze.numerics.constants._

Mathematical

Constant Breeze Scipy
breeze.numerics.constants._ scipy.constants._
Pi Pi pi
golden ratio GoldenRatio golden

Electromagnetic

Constant Breeze Scipy
breeze.numerics.constants._ scipy.constants._
magnetic constant MagneticConstant or Mu0 mu_0
electric constant (vacuum permittivity) ElectricConstant or Epsilon0 epsilon_0
fine structure constant FineStructureConstant or Alpha alpha

Mechanics

Constant Breeze Scipy
breeze.numerics.constants._ scipy.constants._
gravitation constant GravitationConstant G
standard acceleration of gravity StandardAccelerationOfGravity or g g

Thermodynamics

Constant Breeze Scipy
breeze.numerics.constants._ scipy.constants._
Avogadro number AvogadroNumber or NA N_A
molar gas constant MolarGasConstant or R R
Boltzmann constant BoltzmannConstant or k k

Particle

Constant Breeze Scipy
breeze.numerics.constants._ scipy.constants._
light speed LightSpeed or c c
Planck constant PlanckConstant or h h
h bar === h/(2 Pi) hBar hbar
elementary charge ElementaryCharge or e e
electron mass ElectronMass m_e
proton mass ProtonMass m_p
neutron mass NeutronMass m_n
Rydberg constant RydbergConstant Rydberg
Wien displacement law constant WienDisplacementLawConstant or Wien Wien
Stefan-Boltzmann constant StefanBoltzmannConstant or sigma sigma

SI Prefixes

Constant (Breeze/Scipy) value
yotta 1E24
zetta 1E21
exa 1E18
peta 1E15
tera 1E12
giga 1E9
mega 1E6
kilo 1E3
hecto 1E2
deca (deka in Scipy) 1E1
deci 1E-1
centi 1E-2
milli 1E-3
micro 1E-6
nano 1E-9
pico 1E-12
femto 1E-15
atto 1E-18
zepto 1E-21
yocto (not present in Scipy) 1E-24

ICE Binary Prefixes

Constant (Breeze/Scipy) value
kibi 2^10
mebi 2^20
gibi 2^30
tebi 2^40
pebi 2^50
exbi 2^60
zebi 2^70
yobi 2^80