JuliaSymbolics / SymbolicUtils.jl

Symbolic expressions, rewriting and simplification
https://docs.sciml.ai/SymbolicUtils/stable/
Other
524 stars 99 forks source link

Incorrect broadcast semantics for symbolic arrays #562

Open baggepinnen opened 8 months ago

baggepinnen commented 8 months ago

The broadcast semantics for symbolic arrays appears incorrect, the following should result in three unique random numbers:

julia> collect(freeMotion.phi .=> 0.001 .* randn.())
3-element Vector{Pair{SymbolicUtils.BasicSymbolic{Real}, Float64}}:
 (freeMotion₊phi(t))[1] => -0.002044326749022461
 (freeMotion₊phi(t))[2] => -0.002044326749022461
 (freeMotion₊phi(t))[3] => -0.002044326749022461
julia> ones(3) .=> 0.001 .* randn.()
3-element Vector{Pair{Float64, Float64}}:
 1.0 => -0.0004816099930676256
 1.0 => -0.0026310360244916715
 1.0 => 0.0010972452067663496