# \[ANN\] PlusMinus.jl

**URL:** https://discourse.julialang.org/t/ann-plusminus-jl/35033
**Category:** Package Announcements
**Tags:** package, announcement
**Created:** [February 22, 2020, 11:14pm UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033 "2020-02-22T23:14:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [February 22, 2020, 11:14pm UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033/1 "2020-02-22T23:14:30Z")

</div>

Got irked the other day that `2 ± 1` was not already a thing, so I made it a thing.

[PlusMinus.jl](https://github.com/tbeason/PlusMinus.jl) gives you that.

```julia
±(x,y) = (x-y, x+y)

```

That is all.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [February 22, 2020, 11:31pm UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033/2 "2020-02-22T23:31:38Z")

</div>

> [@tbeason](#):
>
> Got irked the other day that `2 ± 1` was not already a thing

Measurements.jl?

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [February 22, 2020, 11:39pm UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033/3 "2020-02-22T23:39:42Z")

</div>

Ah cool. Not familiar with that package but it definitely looks like overkill for what I wanted.

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [February 23, 2020, 12:19am UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033/4 "2020-02-23T00:19:16Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [February 23, 2020, 12:27am UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033/5 "2020-02-23T00:27:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [February 23, 2020, 12:30am UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033/6 "2020-02-23T00:30:59Z")

</div>

to take a measurements function to do the same thing, we would just need a

```julia
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!

```julia
plusminus(x::measuredtypething,y::measuredtypething) = (x+y, x-y)

```

and then we’d still get uncertainties but still have the multiplicity?

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [February 23, 2020, 1:28am UTC](https://discourse.julialang.org/t/ann-plusminus-jl/35033/7 "2020-02-23T01:28:11Z")

</div>

Also `IntervalSets.jl` and `IntervalArithmetic.jl`, which define actual intervals.
