On Sunday, November 3, 2013 9:46:43 AM UTC+1, Marduk wrote:
>
> Just for the record. With the help of Rubi I just solved an integral for 
> which both Mathematica and Maxima gave a rather ugly answer. Rubi provided 
> the same result that appears in a book. Based on this experience I 
> definitely recommend, and if I can find the time I will collaborate, to 
> work on implenting the Rubi rules for Sympy.
>

Sympy needs a better pattern matching and a better assumptions system to 
port Rubi.

I already had a look if it is possible to write a code generator to 
translate Rubi's rules to Sympy, but Sympy's rules and assumptions are not 
as powerful as Mathematica's ones.

By the way, I think that pattern matching through expression trees should 
be somewhat more ground-based than an implementation into Sympy's core. I 
mean, pattern matching should be a tool native to the language itself. 
Python is reaching a widespread usage among scientific research recently, 
unfortunately it's not the best language for scientific purposes.

Most importantly, a good multiple dispatcher is the starting point before a 
good pattern matcher can be written.

I believe that rewriting SymPy in C++ would be a too long journey, and code 
could be harder to maintain, as C++ is a complicated language. Maybe it 
would be better to try either numba or Julia.

There was a discussion this summer about introducing multiple dispatch into 
Sympy, what's the situation now? I think that, as Sympy has types, it would 
be cleaner to switch to a function-struct strategy, where methods of 
classes are not declared inside the class, rather through the usage of 
decorators on external functions.

In Julia types allow only a constructor as a method (unlike classes which 
allow any method inside), multiple dispatch provides the operator 
overloading. Something similar would help to keep the code clean in Sympy, 
with multiple dispatch indeed the code would be far more readable.

Regarding numba's future plans, it seems they got inspired by Julia, and 
they will put a LLVM based multiple dispatcher: 
http://continuumio.github.io/numba-nextgen-docs/

I think that refactoring SymPy with multiple dispatch and less usage of 
class methods would be a good start. After that it would be possible to 
write a check if numba is installed, trying to use it. Otherwise it would 
fall back to the usual python mode. This could help speed up SymPy without 
rewriting it to another language. What do you think?

Otherwise, on Julia a library focusing on pattern matching is already being 
written: https://github.com/kmsquire/Match.jl

Regarding the power pattern matching to simplify the code, just have a look 
at the rules to simplify gamma matrices written in Python code in a recent 
PR, lots of lines of code, if we had a better pattern matching that would 
be far easier to write.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to