All Projects → JuliaPhysics → Physicalconstants.jl

JuliaPhysics / Physicalconstants.jl

Licence: other
Collection of fundamental physical constants with uncertainties. It supports arbitrary-precision constants

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Physicalconstants.jl

Measurements.jl
Error propagation calculator and library for physical measurements. It supports real and complex numbers with uncertainty, arbitrary precision calculations, operations with arrays, and numerical integration.
Stars: ✭ 248 (+350.91%)
Mutual labels:  arbitrary-precision, physics
Rationals
🔟 Implementation of rational number arithmetic for .NET with arbitrary precision.
Stars: ✭ 40 (-27.27%)
Mutual labels:  arbitrary-precision
Coord Rs
[deprecated] A simple, ergonomic vector mathematics crate for Rust
Stars: ✭ 18 (-67.27%)
Mutual labels:  physics
Mrchem
MultiResolution Chemistry
Stars: ✭ 13 (-76.36%)
Mutual labels:  physics
Lua Bint
Arbitrary precision integer arithmetic library in pure Lua
Stars: ✭ 20 (-63.64%)
Mutual labels:  arbitrary-precision
Latticeboltzmann
A 2D Lattice Boltzmann program
Stars: ✭ 34 (-38.18%)
Mutual labels:  physics
Rpn
Math functional language, inspired by Hewlett-Packard Reverse Polish Notation (RPL) language
Stars: ✭ 17 (-69.09%)
Mutual labels:  arbitrary-precision
Flavio
A Python package for flavour physics phenomenology in the Standard model and beyond
Stars: ✭ 49 (-10.91%)
Mutual labels:  physics
Tofu
Project for an open-source python library for synthetic diagnostics and tomography for Fusion devices
Stars: ✭ 35 (-36.36%)
Mutual labels:  physics
Core
The core source repository for the Cherab project.
Stars: ✭ 26 (-52.73%)
Mutual labels:  physics
Imagine Old
Modeling and simulations using computational graphs
Stars: ✭ 25 (-54.55%)
Mutual labels:  physics
Math
Arbitrary-precision arithmetic library for PHP
Stars: ✭ 905 (+1545.45%)
Mutual labels:  arbitrary-precision
Pioneer
A game of lonely space adventure
Stars: ✭ 979 (+1680%)
Mutual labels:  physics
Hldoc
Half-Life game physics described in excruciating detail!
Stars: ✭ 19 (-65.45%)
Mutual labels:  physics
Game Dogfight
Air to air combat game, created in Python 3 using HARFANG 3D.
Stars: ✭ 41 (-25.45%)
Mutual labels:  physics
Webxr Physics
Adds physics to WebXR
Stars: ✭ 18 (-67.27%)
Mutual labels:  physics
Adaptinggravityunity3d
Discontinued - A small library for gravity that adapts to the ground normal the player is standing on
Stars: ✭ 24 (-56.36%)
Mutual labels:  physics
Gravitational Waves Playground
Make gravitational waves visible in an interactive iPad simulation.
Stars: ✭ 33 (-40%)
Mutual labels:  physics
Mcmd
Monte Carlo and Molecular Dynamics Simulation Package
Stars: ✭ 52 (-5.45%)
Mutual labels:  physics
Phaser Tilemap Plus
Tilemap animations, physics, events and custom property enhancements for Tiled JSON map files
Stars: ✭ 44 (-20%)
Mutual labels:  physics

PhysicalConstants.jl

Documentation Build Status Code Coverage
Build Status

Introduction

PhysicalConstants.jl provides common physical constants. They are defined as instances of the new Constant type, which is subtype of AbstractQuantity (from Unitful.jl package) and can also be turned into Measurement objects (from Measurements.jl package) at request.

Constants are grouped into different submodules, so that the user can choose different datasets as needed. Currently, 2014 and 2018 editions of CODATA recommended values of the fundamental physical constants are provided.

Installation

The latest version of PhysicalConstants.jl is available for Julia 1.0 and later versions, and can be installed with Julia built-in package manager. After entering the package manager mode by pressing ], run the command

pkg> add PhysicalConstants

Usage

You can load the package as usual with using PhysicalConstants but this module does not provide anything useful for the end-users. You most probably want to directly load the submodule with the dataset you are interested in. For example, for CODATA 2018 load PhysicalConstants.CODATA2018:

julia> using PhysicalConstants.CODATA2018

julia> SpeedOfLightInVacuum
Speed of light in vacuum (c_0)
Value                         = 2.99792458e8 m s^-1
Standard uncertainty          = (exact)
Relative standard uncertainty = (exact)
Reference                     = CODATA 2018

julia> NewtonianConstantOfGravitation
Newtonian constant of gravitation (G)
Value                         = 6.6743e-11 m^3 kg^-1 s^-2
Standard uncertainty          = 1.5e-15 m^3 kg^-1 s^-2
Relative standard uncertainty = 2.2e-5
Reference                     = CODATA 2018

SpeedOfLightInVacuum and NewtonianConstantOfGravitation are two of the PhysicalConstants defined in the PhysicalConstants.CODATA2018 module, the full list of available constants is given below.

PhysicalConstants can be readily used in mathematical operations, using by default their Float64 value:

julia> import PhysicalConstants.CODATA2018: c_0, ε_0, μ_0

julia> 2 * ε_0
1.77083756256e-11 F m^-1

julia> ε_0 - 1 / (μ_0 * c_0 ^ 2)
-3.8450973786644646e-25 A^2 s^4 kg^-1 m^-3

If you want to use a different precision for the value of the constant, use the function float(float_type, constant), for example:

julia> float(Float32, ε_0)
8.854188f-12 F m^-1

julia> float(BigFloat, ε_0)
8.854187812799999999999999999999999999999999999999999999999999999999999999999973e-12 F m^-1

julia> big(ε_0)
8.854187812799999999999999999999999999999999999999999999999999999999999999999973e-12 F m^-1

julia> big(ε_0) - inv(big(μ_0) * big(c_0)^2)
-3.849883307464075736533920296598236938395867709081184624499315166190408485179288e-25 A^2 s^4 kg^-1 m^-3

Note that big(constant) is an alias for float(BigFloat, constant).

If in addition to units you also want the standard uncertainty associated with the constant, use measurement(x):

julia> using Measurements

julia> import PhysicalConstants.CODATA2018: h, ħ

julia> measurement(ħ)
1.0545718176461565e-34 ± 0.0 J s

julia> measurement(Float32, ħ)
1.0545718e-34 ± 0.0 J s

julia> measurement(BigFloat, ħ)
1.054571817646156391262428003302280744722826330020413122421923470598435912734741e-34 ± 0.0 J s

julia> measurement(BigFloat, ħ) / (measurement(BigFloat, h) / (2 * big(pi)))
1.0 ± 0.0

For more information read the documentation, which includes the full list of constants defined by the package.

License

The PhysicalConstants.jl package is licensed under the MIT "Expat" License. The original author is Mosè Giordano.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].