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
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 *
However…
- If I try
using Measurements: ± as mpm
then replace.±
with.mpm
I get a syntax error
syntax: space before "." not allowed in "((a .* x) .+ rand(d, N)) . at *filename and path*"
- If I try
Measurements.:.±
orMeasurements.:.(±)
I get the same syntax error - 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
, whereBase.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
- Use the
as
keyword above to rename one or both identifiers, eg
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.