SymPy CSE does not work as good as it used to work
https://github.com/sympy/sympy/commit/19c715920e52337d124dda63abdc056f56ec094e
has a negative impact on our CSE routine. An example would be test_simplifications_srt_d2q9_incompressible
in lbmpy
The following example should demonstrate the change, before 19c715920e52337d124dda63abdc056f56ec094e:
import sympy as sp
var = sp.symbols("a b c d")
test = -var[0] + var[3]/9 + var[2]**2/2 + var[2]/3, -var[1] + var[3]/9 + var[2]**2/2 - var[2]/3
sp.cse(test)
>>> ([(x0, c/3), (x1, c**2/2 + d/9)], [-a + x0 + x1, -b - x0 + x1])
After 19c715920e52337d124dda63abdc056f56ec094e:
import sympy as sp
var = sp.symbols("a b c d")
test = -var[0] + var[3]/9 + var[2]**2/2 + var[2]/3, -var[1] + var[3]/9 + var[2]**2/2 - var[2]/3
sp.cse(test)
>>> ([(x0, c/3), (x1, c**2)], [-a + d/9 + x0 + x1/2, -b + d/9 - x0 + x1/2])
The second latest master version does not find the replacements for the divisions.
An issue in Sympy was created here: https://github.com/sympy/sympy/issues/23297