Any way to do integer division in sympy?
问题 I have a very long expression that I think can be simplified, and I thought sympy would be the perfect way to do it. Unfortunately the formula relies on a couple of integer divides, and I can't find any way to represent those in sympy . >>> x=Symbol('x') >>> (x+1)/2 x/2 + 1/2 Clearly not what I want, 1/2 isn't an integer. >>> (x+1)//2 TypeError: unsupported operand type(s) for //: 'Add' and 'int' Obviously sympy doesn't handle // . >>> Integer((x+1)/2) # A long list of error messages, ending