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

CSE does not perform nested nested eliminations of repeated expressions

Open cdsousa opened this issue 6 months ago • 0 comments

Example:

using Symbolics
@variables x y
e = (x*y) + sin(x*y) + sqrt(sin(x*y))
Symbolics.cse(e)

returns an intermediate variable for x*y and another for sin(x*y). It would be expected that the second variable includes the first one in the argument of sin rather than a repeated x*y.

This was working OK before the commit "CSE only exprs that appear more than once" https://github.com/JuliaSymbolics/SymbolicUtils.jl/commit/2c60e25b524dad8ff62d9858e11753ac59f423fb The previous behavior, while suboptimal, is much preferable for the effect of code optimization.

cdsousa avatar Dec 16 '23 19:12 cdsousa