Hey Francesco, 

thanks for your reply! That is super interesting and is exactly the direction I 
meant. 
Multiple dispatch indeed looks quite useful for general purpose algebra 
implementations.
Where could I find out more about the discussion of making it a sympy 
dependency?
And are there some examples for the sympy.strategies module?
Thanks,

Nikolas

On Nov 5, 2014, at 11:41 AM, Francesco Bonazzi <[email protected]> wrote:

> Concerning pattern matching and term rewriting, there is some work by Matthew 
> Rocklin as separate modules (i.e. unrelated to the standard pattern matcher 
> in sympy.core)
> 
> Unification:
> http://matthewrocklin.com/blog/work/2012/11/01/Unification/
> https://github.com/sympy/sympy/tree/master/sympy/unify
> 
> Strategies:
> https://github.com/sympy/sympy/tree/master/sympy/strategies
> 
> He also wrote an independent library to all the definition of multiple 
> dispatched functions in Python:
> http://multiple-dispatch.readthedocs.org/en/latest/
> https://github.com/mrocklin/multipledispatch
> 
> There was some discussion about including multipledispatch as a dependency in 
> SymPy. I don't know what the conclusion was. Despite not being a pattern 
> matcher, it could be very useful to define generic methods acting on 
> different kinds of algebras based on Python's classes.
> 
> Currently the standard pattern matcher (the one defined in sympy.core) does 
> not support assumptions on its wildcards, or at least whenever I tried them, 
> they did not work. So if you declare
> 
> w = Wild('w', integer=True)
> 
> matches won't be restricted to integers only, unfortunately. Furthermore, the 
> pattern matcher is sensible to additive and multiplicative inverses, so 
> you're expected to get a lot more matches on the same expression than 
> Mathematica.
> 
> 
> In [21]: expr = 1/(x+y)
> 
> In [22]: expr.match(x+w)
> Out[22]: 
> ⎧          1  ⎫
> ⎨w: -x + ─────⎬
> ⎩        x + y⎭
> 
> 
> In Mathematica w_ matches y so that x+w -> x+y.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "sympy" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/sympy/a4NS2taAvQ4/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/3fb2c7b3-2ffc-4b68-8db0-fa3b26c3f457%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/BD8B8B3D-AA43-4AEC-9B79-373A3875A0D2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to