Got irked the other day that 2 ± 1
was not already a thing, so I made it a thing.
PlusMinus.jl gives you that.
±(x,y) = (x-y, x+y)
That is all.
Got irked the other day that 2 ± 1
was not already a thing, so I made it a thing.
PlusMinus.jl gives you that.
±(x,y) = (x-y, x+y)
That is all.
Measurements.jl?
Ah cool. Not familiar with that package but it definitely looks like overkill for what I wanted.
Measurements.jl is focused on the same problem - but not exactly…
So when taking a real root we often need to consider the degenerate +/- solutions, this isn’t an artifact of uncertainty in a measurement. It’s just multiple perfectly valid solutions to an operation.
But yea in physics, it is often to have two solutions come from +/- and -/+(no they aren’t always the same don’t ask me to remember exactly why). Now… this technically is a 1 liner from Measurements.jl if we change the meaning of “err” in a measurements struct.
But maybe there is a convenient way to abstract 2-tuples to have the same meaning as the 1-sigma projections? In such a case… though… things get a littttle murky? Not always should roots to an operation be thought of as “uncertainties” and it could lead to misnomers unless we handle them seperately…
I don’t know maybe someone who is more opinionated about this then me can chime in?
You put more thought into that post than I did making the package.
I mostly did it in jest, but I actually did just want that operation to work. Technically I am using it when dealing with some confidence bands, but I do not need the machinery provided by Measurements.jl. I just needed a quick way to compute Real + Real
and Real - Real
. I think there is also an Interval*.jl package that does something similar to represent an interval. Again, not what I wanted.
I guess I should note that this will obviously conflict with Measurements since the packages define that symbol to have different uses.
to take a measurements function to do the same thing, we would just need a
f(x) = (x.val+x.err, x.val - x.err)
sort of situation. But, this does raise an interesting question for me about roots and how on earth they could be distinguished from a value with uncertainty. But! I think you could allow plus minus to take in two measurement types such that!
plusminus(x::measuredtypething,y::measuredtypething) = (x+y, x-y)
and then we’d still get uncertainties but still have the multiplicity?
Also IntervalSets.jl
and IntervalArithmetic.jl
, which define actual intervals.