Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logic operations don't support symbols #334

Open
ahmedantaar opened this issue Jan 27, 2021 · 3 comments
Open

logic operations don't support symbols #334

ahmedantaar opened this issue Jan 27, 2021 · 3 comments

Comments

@ahmedantaar
Copy link

The logic operations don't support symbols like arithmetic operations, I tried it in sympy but it was super slow but in symengine it gives me errors. I don't know if it's implemented and I don't know or what.

Thanks in advance.

@rikardn
Copy link
Contributor

rikardn commented Jan 27, 2021

Could you please provide a short example program that doesn't work as expected?

@ertsiger
Copy link

ertsiger commented Apr 1, 2021

Hi, I've just started experimenting a bit with symengine given that sympy is a bit slow for some operations, but I have found a case similar to what @ahmedantaar is describing. For example, the following code snippet does not work:

from symengine import sympify
formula = sympify("a & b")
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

I have also tried to do the following (following the sympy syntax):

from symengine import symbols
a, b = symbols("a b")
formula = a & b
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: unsupported operand type(s) for &: 'symengine.lib.symengine_wrapper.Symbol' and 'symengine.lib.symengine_wrapper.Symbol'

Given that the operator seems undefined I went for using And instead over these two symbols, but it does not seem to work either:

from symengine.lib.symengine_wrapper import And
from symengine import symbols
a, b = symbols("a b")
formula = And(a, b)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "symengine_wrapper.pyx", line 1401, in symengine.lib.symengine_wrapper.And.__new__
  File "symengine_wrapper.pyx", line 3991, in symengine.lib.symengine_wrapper.logical_and
TypeError: Cannot convert symengine.lib.symengine_wrapper.Symbol to symengine.lib.symengine_wrapper.Boolean

I have also taken a look at the test cases but none of them are using symbols, so I'm not sure if I'm doing something wrong or the features I intend to use are unsupported as of now.

Thanks.

@rikardn
Copy link
Contributor

rikardn commented May 31, 2021

Unfortunately symengine does not yet support symbols taking on boolean values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants