Skip to content

Symbolics.jl support? #142

@LebedevRI

Description

@LebedevRI

Currently, Measurement is a subtype of, and operates on, AbstractFloat,
while Symbolics.jl's variables/expressions are subtype of Real.
Given that AbstractFloat is a subtype of Real, currently one can not pass
said symbolic variables through Measurements.jl.

A very rough hack (s/AbstractFloat/Real/) shows that in principle, it works:

(@v1.8) pkg> dev /repositories/Measurements.jl
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`

julia> using Symbolics, Measurements
[ Info: Precompiling Measurements [eff96d63-e80a-5855-80a2-b1b0885c5ab7]
WARNING: Method definition measurement(Real) in module Measurements at /repositories/Measurements.jl/src/Measurements.jl:94 overwritten at /repositories/Measurements.jl/src/Measurements.jl:95.
  ** incremental compilation may be fatally broken for this module **


julia> @variables a b c d
4-element Vector{Num}:
 a
 b
 c
 d

julia> Q = measurement(a, b) + measurement(c, d)
Error showing value of type Measurement{Num}:
ERROR: StackOverflowError:

julia> show(stdout, MIME("text/latex"), Q.val)
$$ \begin{equation}
a + c
\end{equation}
 $$
julia> show(stdout, MIME("text/latex"), Q.err)
$$ \begin{equation}
\sqrt{\left|b\right|^{2} + \left|d\right|^{2}}
\end{equation}
 $$
julia> 

Question: conceptually, is this something that could be supported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions