# WARNING: both IntervalArithmetic and Measurements export "±"

**URL:** https://discourse.julialang.org/t/warning-both-intervalarithmetic-and-measurements-export/93053
**Category:** New to Julia
**Created:** [January 16, 2023, 10:59pm UTC](https://discourse.julialang.org/t/warning-both-intervalarithmetic-and-measurements-export/93053 "2023-01-16T22:59:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![conalbrown](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/conalbrown/32/30423_2.png) [@conalbrown](https://discourse.julialang.org/u/conalbrown)
#### Post date: [January 16, 2023, 10:59pm UTC](https://discourse.julialang.org/t/warning-both-intervalarithmetic-and-measurements-export/93053/1 "2023-01-16T22:59:54Z")

</div>

I trying to learn about intervals in a Pluto notebook using both IntervalArithmetic and Measurements.

I understandably get the error in the thread title when I try to use `±` to replicate the notebook extract here:  
[https://discourse.julialang.org/t/how-to-fit-a-function-to-measurements-with-error/65369/6](https://discourse.julialang.org/t/how-to-fit-a-function-to-measurements-with-error/65369/6)

The code replicates fine if IntervalArithmetic is not used but I want to be able to use both packages within the one Pluto notebook.

Normally I get around this problem with _PackageName.function_. However, this doesn’t work here. I have tried following this page:  
[Modules · The Julia Language](https://docs.julialang.org/en/v1/manual/modules/#namespace-management) \*

However…

1. If I try `using Measurements: ± as mpm` then replace `.±` with `.mpm` I get a syntax error

```julia
syntax: space before "." not allowed in "((a .* x) .+ rand(d, N)) . at *filename and path*"

```

1. If I try `Measurements.:.±` or `Measurements.:.(±)` I get the same syntax error
2. if I try `using IntervalArithmetic: ± as iapm` this only brings in that one feature from the package but I want to use `..` and all the other features

Any suggestions? My preference would be to get option 2 working.

- 

> The parent module may be accessible using a chain of submodules like `Base.Math.sin` , where `Base.Math` is called the _module path_ . Due to syntactic ambiguities, qualifying a name that contains only symbols, such as an operator, requires inserting a colon, e.g. `Base.:+` . A small number of operators additionally require parentheses, e.g. `Base.:(==)` .

and

> 1. Use the `as` keyword above to rename one or both identifiers, eg

```julia
julia> using .A: f as f

julia> using .B: f as g

```

would make `B.f` available as `g`. Here, we are assuming that you did not use `using A` before, which would have brought `f` into the namespace.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [January 16, 2023, 11:24pm UTC](https://discourse.julialang.org/t/warning-both-intervalarithmetic-and-measurements-export/93053/2 "2023-01-16T23:24:08Z")

</div>

> [@conalbrown](#):
>
> If I try `using Measurements: ± as mpm` then replace `.±` with `.mpm` I get a syntax error

`Measurements.±` has already a non-infix operator equivalent: [`Measurements.measurement`](https://juliaphysics.github.io/Measurements.jl/stable/usage/#Measurements.measurement), you don’t need to make your own function. But non-infix operator can’t be used as…infix operators, that’s why your attempt to use `.mpm` wouldn’t work. But you can do

```julia
julia> using Measurements: measurement

julia> measurement(10, 1)
10.0 ± 1.0

julia> measurement.([10, 20, 30], [1, 2, 3])
3-element Vector{Measurements.Measurement{Float64}}:
 10.0 ± 1.0
 20.0 ± 2.0
 30.0 ± 3.0

```

---

<div class="post-metadata">

### Author: ![conalbrown](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/conalbrown/32/30423_2.png) [@conalbrown](https://discourse.julialang.org/u/conalbrown)
#### Post date: [January 16, 2023, 11:34pm UTC](https://discourse.julialang.org/t/warning-both-intervalarithmetic-and-measurements-export/93053/3 "2023-01-16T23:34:02Z")

</div>

If I understand your answer, I need to reformat the expression so

```julia
y = ((a .* x) .+ rand(d, N)) .± rand(d, N)

```

is rewritten as

```julia
y = measurement.((a.*x .+ rand(d, N)), rand(d, N))

```

This works!

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [January 16, 2023, 11:39pm UTC](https://discourse.julialang.org/t/warning-both-intervalarithmetic-and-measurements-export/93053/4 "2023-01-16T23:39:51Z")

</div>

> [@conalbrown](#):
>
> ```julia
> y = measurement.((a.*x .+ rand(d, N)), rand(d, N))
> 
> ```

I don’t know what `a`, `x`, `d` and `N` are, but if `d` and `N` are integers, `a` is a scalar and `x` is a matrix `d`x`N`, then you can more simply do

```julia
y = measurement.((a.*x .+ rand.()), rand.())

```

which avoids allocating two temporary matrices `d`x`N` in the first place.
