(self, other, method=0)
return Mul(self, other)
Helper function for Product simplification
Helper function for Product simplification
Helper function for Product simplification
def product_mul(self, other, method=0):
    """Helper function for Product simplification"""
    from sympy.concrete.products import Product

    if type(self) == type(other):
        if method == 0:
            if self.limits == other.limits:
                return Product(self.function * other.function, *self.limits)
        elif method == 1:
            if simplify(self.function - other.function) == 0:
                if len(self.limits) == len(other.limits) == 1:
                    i = self.limits[0][0]
                    x1 = self.limits[0][1]
                    y1 = self.limits[0][2]
                    j = other.limits[0][0]
                    x2 = other.limits[0][1]
                    y2 = other.limits[0][2]

                    if i == j:
                        if x2 == y1 + 1:
                            return Product(self.function, (i, x1, y2))
                        elif x1 == y2 + 1:
                            return Product(self.function, (i, x2, y1))

    return Mul(self, other)
def product_mul ( self , other , method = 0 ) : from sympy . concrete . products import Product if type ( self ) == type ( other ) : if method == 0 : if self . limits == other . limits : return Product ( self . function * other . function , * self . limits ) elif method == 1 : if simplify ( self . function - other . function ) == 0 : if len ( self . limits ) == len ( other . limits ) == 1 : i = self . limits [ 0 ] [ 0 ] x1 = self . limits [ 0 ] [ 1 ] y1 = self . limits [ 0 ] [ 2 ] j = other . limits [ 0 ] [ 0 ] x2 = other . limits [ 0 ] [ 1 ] y2 = other . limits [ 0 ] [ 2 ] if i == j : if x2 == y1 + 1 : return Product ( self . function , ( i , x1 , y2 ) ) elif x1 == y2 + 1 : return Product ( self . function , ( i , x2 , y1 ) ) return Mul ( self , other )