0

When I compute the LCM of multiple polynomials, the result seems to be always expanded:

>>> from sympy import lcm
>>> from sympy.abc import x,y,z
>>> lcm([x+y,y+z,z+x])
x**2*y + x**2*z + x*y**2 + 2*x*y*z + x*z**2 + y**2*z + y*z**2

I'd rather get the results as a product, like this:

>>> lcm([x+y,y+z,z+x]).factor()
(x + y)*(x + z)*(y + z)

Of course, I can (like in the example) use factor(), but this requires extra time. I assume that internally the result first exists as a list of factors and then explicitly expanded. I'd be fine with that product of factors, prior to expansion.

Is there a way to instruct sympy to hand back such an unexpanded product of factors?

cxxl
  • 4,939
  • 3
  • 31
  • 52

0 Answers0