Hi,

when I was at high school I remember figuring out how to factor this:

In [1]: 2*x*y*z + x*y**2 + x*z**2 + y*x**2 + y*z**2 + z*x**2 + z*y**2
Out[1]:
             2      2      2      2      2      2
2*x*y*z + x*y  + x*z  + y*x  + y*z  + z*x  + z*y


If you don't know the result, which you don't, it's actually pretty
difficult. It took us couple hours with friens. Well, in pure Python
you can do just this:

In [2]: %time factor(_)
CPU times: user 2.66 s, sys: 0.00 s, total: 2.66 s
Wall time: 2.67 s
Out[3]: (x + y)*(y + z)*(x + z)

Not bad. However the time varies a lot on my laptop if I repeat it in
another ipython session -- from 0.7s (!) to 8s. Can anyone verify this
please? You need the latest hg sympy. Why is that?

To make Sage guys happy after the debackle with pi.evalf(10**6):

sage: var("y z")
(y, z)
sage: 2*x*y*z + x*y**2 + x*z**2 + y*x**2 + y*z**2 + z*x**2 + z*y**2
y*z^2 + x*z^2 + y^2*z + 2*x*y*z + x^2*z + x*y^2 + x^2*y
sage: %time factor(_)
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.01 s
(y + x)*(z + x)*(z + y)

I think it uses Maxima, but I may be wrong. In any case we still need
to improve, but I am glad sympy can already do it, instead of hanging.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to