Hi:
import sympy
x=sympy.symbols('x',real=True)
sympy.integrate(sympy.Heaviside(x-1)*(x-1)+1,(x,0,2))
the output is 2, which is wrong, the correct answer is 5/2
I try the following Mathematica code:
Integrate[HeavisideTheta[x - 1]*(x - 1) + 1, {x, 0, 2}] which gives me 5/2
also the following piecewise function:
sympy.integrate(sympy.Piecewise((1,x<1),(x,x>1)),(x,0,2)) which gives me the correct answer
So I want to ask whether it is a bug in Heaviside function or there are some special explanations in sympy?