JuliaSymbolics / Symbolics.jl

Symbolic programming for the next generation of numerical software
https://docs.sciml.ai/Symbolics/stable/
Other
1.36k stars 154 forks source link

scalarize does not fully scalarize #1208

Open YingboMa opened 2 months ago

YingboMa commented 2 months ago
julia> using Symbolics

julia> @variables  pos[1:3]
1-element Vector{Symbolics.Arr{Num, 1}}:
 pos[1:3]

julia> Symbolics.scalarize(pos/norm(pos))
3-element Vector{Num}:
 pos[1] / sqrt(Symbolics._mapreduce(#396, +, pos, Colon(), (:init => false,)))
 pos[2] / sqrt(Symbolics._mapreduce(#396, +, pos, Colon(), (:init => false,)))
 pos[3] / sqrt(Symbolics._mapreduce(#396, +, pos, Colon(), (:init => false,)))

Ref: https://github.com/SciML/ModelingToolkit.jl/issues/2920

ufechner7 commented 2 months ago

Would be nice if this could be fixed.