Symbolics.jl icon indicating copy to clipboard operation
Symbolics.jl copied to clipboard

Arrays of symbolic terms break basic arithmetic

Open ojwoodford opened this issue 2 years ago • 1 comments

The following does not work:

using Symbolics

function proj(x)
    return x[1:end-1] ./ x[end]
end

@variables x[1:3] s
println(proj(x))         # (broadcast(/, x[1:2], Ref(x[3])))[1:2]
println(proj(x * s))     # ERROR: MethodError: no method matching length(::SymbolicUtils.Term{Any, Nothing})

I would expect this to be fine.

I'm using Symbolics v4.10.3

ojwoodford avatar Aug 09 '22 09:08 ojwoodford

Also failing:

using Symbolics

@variables x[1:2] s
(x[1] * s) / (x[2] * s)   # Works
y = x .* s
z = y[1] / y[2]      # ERROR: MethodError: no method matching /(::SymbolicUtils.Term{Any, Nothing}, ::SymbolicUtils.Term{Any, Nothing})

ojwoodford avatar Aug 09 '22 09:08 ojwoodford

It seems #696 fixed this.

shashi avatar Aug 12 '22 17:08 shashi