symengine.py icon indicating copy to clipboard operation
symengine.py copied to clipboard

`is_real` is None when sympyfing a sympy Symbols where `real=True`

Open doppioandante opened this issue 3 months ago • 3 comments

doppioandante avatar Aug 31 '25 20:08 doppioandante

symengine does not have a system with assumptions connected to symbol objects and the trend in sympy is to also move from this system towards the new query system. There is a similar system in symengine, but it cannot be used from Python yet. The idea is to have something like

x = symengine.Symbol("x")
assumptions = symengine.Assumptions(x.memberof(symengine.Reals))
is_real(x, assumptions)

rikardn avatar Sep 01 '25 06:09 rikardn

symengine does not have a system with assumptions connected to symbol objects and the trend in sympy is to also move from this system towards the new query system. There is a similar system in symengine, but it cannot be used from Python yet. The idea is to have something like

x = symengine.Symbol("x") assumptions = symengine.Assumptions(x.memberof(symengine.Reals)) is_real(x, assumptions)

Thanks for the heads up, I stumbled into this because after converting my sympy expression to symengine the substitution was not working correctly, and I figured that sympy refused to substitute a 'x' with real=True to a plain x (which had lost the real attribute after conversion)

doppioandante avatar Sep 01 '25 18:09 doppioandante

We could use the PySymbol interface to convert sympy Symbols while keeping a copy inside the symengine symbol.

isuruf avatar Sep 01 '25 20:09 isuruf