JuliaSymbolics/SymbolicUtils.jl

Casts from float64, int64, to symbolic types are missing

Opened this issue · 4 comments

I have any array of equations created by some other symbolic code, and it breaks when I try to substitute the value 1.0 for the rhs of an equation.

I just want a representation of the value 1.0, and I can't seem to create it in the obvious way (see below).

t = SymbolicUtils.BasicSymbolic{Real}(1.0)
ERROR: MethodError: no method matching SymbolicUtils.BasicSymbolic{Real}(::Float64)

Closest candidates are:
  (::Type{SymbolicUtils.BasicSymbolic{T}} where T)(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
   @ SymbolicUtils ~/.julia/packages/SymbolicUtils/qyMYa/src/types.jl:27

Stacktrace:
 [1] top-level scope
   @ REPL[18]:1

Here's a very short MWE, which is similar to what I'm trying to do:

using ModelingToolkit
@variables x,y,z
 eqvec = [x ~ z, y~x^2+z]
rhs_vec = [e.rhs for e in eqvec]
#rhs_vec[1] = x
#rhs_vec[1] = x/x
rhs_vec[1] = 1.0

Please use

SymbolicUtils.Term{Real}(identity, [1.0])

Sorry. This is a known issue, and we still haven't provided a simpler way.

Please remove Symbolics.wrap if you used it.