JuliaPhysics / 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.

Home Page:https://juliaphysics.github.io/Measurements.jl/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error value equal to zero when taking a ratio

CITESmike2018 opened this issue · comments

Hi,
I get an error equal to zero when I do the ratio x/x, but if x is assigned a value and y the same value the ratio of x/y is the correct answer. See screenshot:

Screen Shot 2020-09-18 at 5 37 19 PM

This isn't a bug but a feature. x is exactly the same thing as x and there is no doubt that x/x is equal to 1, so the uncertainty must be 0. y instead is an independent measure which accidentally happens to have yielded the same value and uncertainty as x, but it's fundamentally something different.

If the fact that x is the same thing as x wasn't taken into account, this wouldn't be possible

julia> x = 1 ± 0.5
1.0 ± 0.5

julia> y = 1 ± 0.5
1.0 ± 0.5

julia> x + x
2.0 ± 1.0

julia> 2 * x
2.0 ± 1.0

julia> x + y
2.0 ± 0.71

x + x would return the same as x + y, which is different from 2 * x, which is totally flawed.

This is also extensively documented in the manual, see for example:

See also #47 and #74