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.

Reply via email to