These are chat archives for symengine/symengine

1st
Aug 2017
Shikhar Jaiswal
@ShikharJ
Aug 01 2017 08:29
@isuruf In case of Qubits in SymPy, the arguments are passed as Qubit('00'), which are processed as sympify(0) when using SymPy, but the same expression gets processed to sympify(''0'') in SymEngine.py, which raises an error. Can I introduce a try-except block, within sympify checking for conversion to int? Is there another approach to this?
Isuru Fernando
@isuruf
Aug 01 2017 08:33
why is there a difference?
Shikhar Jaiswal
@ShikharJ
Aug 01 2017 08:43

I'm not too sure on that. From SymEngine.py's code:

if isinstance(a, str):
        return c2py(symengine.parse(a.encode("utf-8")))
    return _sympify(a, True)

Ideally all strings should be parsed directly, but I think the string object is also being passed to _sympify() which gives:

symengine.lib.symengine_wrapper.SympifyError: sympy2symengine: Cannot convert ''0'' to a symengine type.
Isuru Fernando
@isuruf
Aug 01 2017 08:46
So, it's passed '0' as a string instead of 0 as a string.
Shikhar Jaiswal
@ShikharJ
Aug 01 2017 08:46
Ah yes, sorry about that.
Didn't notice it.