All Projects → JuliaPhysics → Measurements.jl

JuliaPhysics / Measurements.jl

Licence: other
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.

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Measurements.jl

Arb
C library for arbitrary-precision ball arithmetic
Stars: ✭ 280 (+12.9%)
Mutual labels:  linear-algebra, arbitrary-precision, complex-numbers
cplot
Function plotter
Stars: ✭ 27 (-89.11%)
Mutual labels:  physics, complex-numbers
mathcore
Advanced .NET math library (.NET Standard).
Stars: ✭ 24 (-90.32%)
Mutual labels:  linear-algebra, complex-numbers
bcmath-extended
Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.
Stars: ✭ 59 (-76.21%)
Mutual labels:  arbitrary-precision, complex-numbers
Physicalconstants.jl
Collection of fundamental physical constants with uncertainties. It supports arbitrary-precision constants
Stars: ✭ 55 (-77.82%)
Mutual labels:  arbitrary-precision, physics
Calc
C-style arbitrary precision calculator
Stars: ✭ 127 (-48.79%)
Mutual labels:  arbitrary-precision, complex-numbers
math
Complex special functions and common mathematical operations in JavaScript
Stars: ✭ 42 (-83.06%)
Mutual labels:  arbitrary-precision, complex-numbers
Grassmann.jl
⟨Leibniz-Grassmann-Clifford⟩ differential geometric algebra / multivector simplicial complex
Stars: ✭ 289 (+16.53%)
Mutual labels:  linear-algebra, complex-numbers
Mpmath
Python library for arbitrary-precision floating-point arithmetic
Stars: ✭ 511 (+106.05%)
Mutual labels:  arbitrary-precision, complex-numbers
Numphp
Mathematical PHP library for scientific computing
Stars: ✭ 120 (-51.61%)
Mutual labels:  linear-algebra, complex-numbers
Big Math
Advanced Java BigDecimal math functions (pow, sqrt, log, sin, ...) using arbitrary precision.
Stars: ✭ 173 (-30.24%)
Mutual labels:  arbitrary-precision, complex-numbers
Curso Algebra Lineal
Curso de Álgebra Lineal
Stars: ✭ 234 (-5.65%)
Mutual labels:  linear-algebra
Bulletsharp
.NET wrapper for the Bullet physics library
Stars: ✭ 208 (-16.13%)
Mutual labels:  physics
Technicalnote
Repository to store what we have studied. 📖 We want everyone to get a job through TechnicalNote.
Stars: ✭ 206 (-16.94%)
Mutual labels:  linear-algebra
P2.js
JavaScript 2D physics library
Stars: ✭ 2,367 (+854.44%)
Mutual labels:  physics
Haskanoid
A breakout game in Haskell using SDL and FRP, with Wiimote and Kinect support.
Stars: ✭ 242 (-2.42%)
Mutual labels:  physics
Pydy
Multibody dynamics tool kit.
Stars: ✭ 232 (-6.45%)
Mutual labels:  physics
Insect
High precision scientific calculator with support for physical units
Stars: ✭ 2,469 (+895.56%)
Mutual labels:  physics
Dustracing2d
Dust Racing 2D is a traditional top-down car racing game including a level editor.
Stars: ✭ 199 (-19.76%)
Mutual labels:  physics
Itensors.jl
A Julia library for efficient tensor computations and tensor network calculations
Stars: ✭ 199 (-19.76%)
Mutual labels:  physics

Measurements.jl

Documentation Build Status Code Coverage
Build Status

Introduction

What Is This Package Useful For?

image

Image credit: "xkcd: Error Bars" (CC-BY-NC 2.5)

Measurements.jl relieves you from the hassle of propagating uncertainties coming from physical measurements, when performing mathematical operations involving them. The linear error propagation theory is employed to propagate the errors.

This library is written in Julia, a modern high-level, high-performance dynamic programming language designed for technical computing.

When used in the Julia interactive session, it can serve also as an easy-to-use calculator.

Features List

  • Support for most mathematical operations available in Julia standard library and special functions from SpecialFunctions.jl package, involving real and complex numbers. All existing functions that accept AbstractFloat (and Complex{AbstractFloat} as well) arguments and internally use already supported functions can in turn perform calculations involving numbers with uncertainties without being redefined. This greatly enhances the power of Measurements.jl without effort for the users
  • Functional correlation between variables is correctly handled, so x-x ≈ zero(x), x/x ≈ one(x), tan(x) ≈ sin(x)/cos(x), cis(x) ≈ exp(im*x), etc...
  • Support for arbitrary precision (also called multiple precision) numbers with uncertainties. This is useful for measurements with very low relative error
  • Define arrays of measurements and perform calculations with them. Some linear algebra functions work out-of-the-box
  • Propagate uncertainty for any function of real arguments (including functions based on C/Fortran calls), using @uncertain macro
  • Function to get the derivative and the gradient of an expression with respect to one or more independent measurements
  • Functions to calculate standard score and weighted mean
  • Parse strings to create measurement objects
  • Easy way to attach the uncertainty to a number using the ± sign as infix operator. This syntactic sugar makes the code more readable and visually appealing
  • Extensible in combination with external packages: you can propagate errors of measurements with their physical units, perform numerical integration with QuadGK.jl, numerical and automatic differentiation, and much more.
  • Integration with Plots.jl.

The method used to handle functional correlation is described in this paper:

A current limitation of the package is that it is not yet possible to define quantities related by a correlation matrix.

If you use use this package for your research, please cite it.

Documentation

The complete manual of Measurements.jl is available at https://juliaphysics.github.io/Measurements.jl/stable/. There, people interested in the details of the package, in order integrate the package in their workflow, can can find a technical appendix explaining how the package internally works.

Installation

The latest version of Measurements.jl is available for Julia v1.0 and later releases, and can be installed with Julia built-in package manager. In a Julia session, after entering the package manager mode with ], run the command

pkg> update
pkg> add Measurements

Older versions of this package are also available for Julia 0.4-0.7.

Usage

After installing the package, you can start using it with

using Measurements

The module defines a new Measurement data type. Measurement objects can be created with the two following constructors:

measurement(value, uncertainty)
value ± uncertainty

where

  • value is the nominal value of the measurement
  • uncertainty is its uncertainty, assumed to be a standard deviation.

They are both subtype of AbstractFloat. Some keyboard layouts provide an easy way to type the ± sign, if your does not, remember you can insert it in Julia REPL with \pm followed by TAB key. You can provide value and uncertainty of any subtype of Real that can be converted to AbstractFloat. Thus, measurement(42, 33//12) and pi ± 0.1 are valid.

measurement(value) creates a Measurement object with zero uncertainty, like mathematical constants. See below for further examples.

Every time you use one of the constructors above, you define a new independent measurement. Instead, when you perform mathematical operations involving Measurement objects you create a quantity that is not independent, but rather depends on really independent measurements.

Most mathematical operations are instructed, by operator overloading, to accept Measurement type, and uncertainty is calculated exactly using analityc expressions of functions’ derivatives.

In addition, it is possible to create a Complex measurement with complex(measurement(a, b), measurement(c, d)).

measurement(string)

measurement function has also a method that enables you to create a Measurement object from a string.

This module extends many methods defined in Julia’s mathematical standard library, and some methods from widespread third-party packages as well. This is the case for most special functions in SpecialFunctions.jl package, and the quadgk integration routine from QuadGK.jl package. See the full manual for details.

Examples

julia> using Measurements

julia> a = measurement(4.5, 0.1)
4.5 ± 0.1

julia> b = 3.8 ± 0.4
3.8 ± 0.4

julia> 2a + b
12.8 ± 0.4472135954999579

julia> x = 8.4 ± 0.7

julia> x - x
0.0 ± 0.0

julia> x/x
1.0 ± 0.0

julia> x*x*x - x^3
0.0 ± 0.0

julia> sin(x)/cos(x) - tan(x)
-2.220446049250313e-16 ± 0.0 # They are equal within numerical accuracy

License

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

Please, cite the paper Giordano 2016 (http://arxiv.org/abs/1610.08716) if you employ this package in your research work. For your convience, a BibTeX entry is provided in the CITATION.bib file.

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].