Normal unification is decently fast. A simple implementation in another
project is herehttps://github.com/logpy/logpy/blob/master/logpy/core.py#L58.
However our implementation of unification in an associative/commutative
context is naive and painfully slow. AC matching is a hard problem but in
On Fri, Mar 15, 2013 at 6:56 AM, Aaron Meurer asmeu...@gmail.com wrote:
How fast is this? Does it scale well for large expressions with many
variables? Can it be modified to return the mapping?
My symatch branch does what your asking...it's called `symbol_match`
as I recall. I'm stalled
If two expression trees are structurally the same they should unify under
some mapping of symbols. usympy makes this very easy to test for:
def structurally_equal(a, b):
... from sympy.unify import usympy
... if isinstance(a, (list, tuple)):
... if type(a) != type(b): return