This *might* work in the PR that I am struggling with that upgrades Piecewise. #12587
On Thursday, April 27, 2017 at 11:41:47 PM UTC-5, chaowen guo wrote: > > 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? > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/fb6259e0-0420-4363-bd37-cb8b0795057a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.