These are chat archives for symengine/symengine

10th
Dec 2015
Isuru Fernando
@isuruf
Dec 10 2015 02:54
@certik, your changes fit into my requirements as well. Only issue is that looking at CMake Find modules in the official repository most of them allow a specific root directory for finding the package. For. eg. FindBoost.cmake uses the location Boost_DIR, FindZLIB.cmake uses ZLIB_ROOT etc.
Ralf Stephan
@rwst
Dec 10 2015 08:11
I just see that member functions of Expr don't have the same signature as the same of sympy.Expr which might be too much work. I understand in general however symengine.py tries to provide the same features as SymPy?
Ralf Stephan
@rwst
Dec 10 2015 08:51
Ah no, I still don't have a firm grasp on symengine.py. I meant Basic instead of Expr.
Isuru Fernando
@isuruf
Dec 10 2015 08:54
Yes, we would like to have all the features of Expr, but there are some things that we do differently.
Ralf Stephan
@rwst
Dec 10 2015 09:06
Let's assume there is symengine.series() and I want to provide for the SymPy case the functionality that calling series(ex) as well as ex.series() call symengine.series(ex) in case of univar, and call sympy.series(ex) in all other cases. Which Python functions in symengine_wrapper.pyx do I have to write? My first guess is to write Basic.series() because there is no Expr, right?
Isuru Fernando
@isuruf
Dec 10 2015 09:07
Right. you'll need to write a Basic.series()
Ralf Stephan
@rwst
Dec 10 2015 09:11
And of course also a global series(). Now both would have to call sympy.series(ex) for the unhandled cases, so the Basic must be converted to SymPy then the call and then the result must be converted back, right?
Isuru Fernando
@isuruf
Dec 10 2015 09:13
Yes. sympy.series accepts symengine objects as well, but the output would be a SymPy object, so that has to be converted to symengine.
Ralf Stephan
@rwst
Dec 10 2015 09:14
Ah that accepts symengine objects, that is good. And I don't need special-case for Sage because Sage also includes SymPy. OK for the moment, thanks.
How does this work, that sympy.series() accepts a Basic. Do I need to convert explicitly?
Isuru Fernando
@isuruf
Dec 10 2015 09:20
It will convert it into a SymPy object first and then do the calculation. Like in Sage, most methods accept SymPy objects and then output Sage objects.
Ralf Stephan
@rwst
Dec 10 2015 09:32
Just a wild speculation: in principle symengine.py could contain most of SymPy but cythonized. Is this too naive?
Isuru Fernando
@isuruf
Dec 10 2015 09:50
I'm not that familiar with sympy to make a guess.
Ralf Stephan
@rwst
Dec 10 2015 10:04
Another catch: I need std::unordered_map which is in Cython-0.20.2 but you require only 0.19.1 for symengine.py. I could include the PXD from the 0.20.2 Cython source, or you could raise requirements. However, even the newest standard OpenSuSE has only 0.19.2. So better keep the requirements?
Isuru Fernando
@isuruf
Dec 10 2015 10:07
Yes. there are some cases where not even the latest version can be used, so we declare them in symengine.pxd like https://github.com/symengine/symengine.py/blob/master/symengine/lib/symengine.pxd#L93
Ralf Stephan
@rwst
Dec 10 2015 10:09
Ah, didn't see that, thanks.
Ondřej Čertík
@certik
Dec 10 2015 14:38
@rwst yes, the symengine.py can definitely contain cythonized stuff from sympy. But for example the basic manipulation is much faster in symengine than what I was ever able to achieve using just Cython. The same with multivariate series --- we wouldn't be able to get even close to Piranha. But yes, if Cythonizing provides some good speedup for some algorithm in sympy, we should definitely include it in symengine.py. And then later move it to symengine itself. So far our approach was to implement it directly in symengine itself in C++ and just wrap it. That way also Julia, Ruby and other wrappers can use it.
@rwst thanks for implementing the series stuff. I would be interested in seeing how it compares to your series benchmarks.
And ginac.

Ultimately I expect some libraries to be faster for the univariate stuff that we have so far, but as long as we are at least as fast as ginac, then we are fine.

We should find some good benchmarks for multivariate stuff. I found some examples here:
http://www.mathworks.com/help/symbolic/mupad_ref/mtaylor.html
http://www.maplesoft.com/support/help/maple/view.aspx?path=mtaylor

Ralf Stephan
@rwst
Dec 10 2015 15:25

Odd Cython error:

    ctypedef unordered_map[short, RCP[const Basic]] umap_short_basic "SymEngine::umap_short_basic"
                                           ^
------------------------------------------------------------
symengine.pxd:183:44: Expected ']', found 'Basic'

Two lines later the same RCP[const Basic] passes without problems:

    ctypedef set[RCP[const_Basic], RCPBasicKeyLess] set_basic "SymEngine::set_basic"
aah ok

-(

Ralf Stephan
@rwst
Dec 10 2015 15:35
That may work now but I can't assign a RCP[const_Basic] to a RCP[const Basic] (have it as argument to c2py).
Ralf Stephan
@rwst
Dec 10 2015 16:42
@certik I can also understand going with C++ because of Cython being such a PITA. Let's just say my blood pressure is a bit higher today...
Francesco Biscani
@bluescarni
Dec 10 2015 17:04
tbh I can't wait to be able to do scripting directly in C++ :) Hope that cling or something similar takes off
Isuru Fernando
@isuruf
Dec 10 2015 17:04
@rwst, Cython gives odd errors when the template parameter has a const keyword in it. Did you find a way around it? If not we'll have to declare the methods in symengine.pxd as in map_basic_basic.