I suspect you found a bug in the matching algorithm. It's possible that it's just very inefficient for this equation too. The only way to find out is to step through the algorithm and see what it's doing.
Aaron Meurer On Sep 15, 2013, at 12:13 PM, Thilina Rathnayake <[email protected]> wrote: Hi All, Addressing issue 4004<https://code.google.com/p/sympy/issues/detail?id=4004>, the equation after expanding can be written as below, In [1]: t = (x*y + y*z + x*z)**2 - 4*x*y*z*(x + y + z) > In [2]: expand(t) > Out[2]: > 2 2 2 2 2 2 2 2 2 > x ⋅y - 2⋅x ⋅y⋅z + x ⋅z - 2⋅x⋅y ⋅z - 2⋅x⋅y⋅z + y ⋅z > This is of the form `X**2 + Y**2 + Z**2 - 2*X*Y - 2*Y*Z - 2*X*Z` with X = x*y, Y = y*z and Z = z*x. Latter can be solved by the Diophantine module for X, Y, Z and we can recover solutions for x, y and z. I tried to automate this process with Wild's and `match()` but couldn't do it. Given an expression, I tried to determine if it is in the form `ap**2 + bq**2 + cr**2 + d*p*q + e*q*r + f*r*p` where a, b, c, d, e, f are Wilds trying to match Integers(used exclude=[x, y, z] while creating these) and p, q, r trying to match the variables. In[3]: _.match(a*p**2 + b*q**2 + c*r**2 + d*p*q + e*q*r + f*r*q) Above kept running forever. Is there a way to efficiently pattern match an expression so that we can decide whether it belongs to a particular form or not? Regards, Thilina. -- 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. -- 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.
