Yes, this looks like a bug with the meijerg integration algorithm.
Please open an issue for it.

For integrate(Heaviside(x-S(1)),(x,-1,2)), simplify() reduces this to
1. So the "bug" here is that the appropriate simplification routine
should be called by integrate().  Open an issue for that one too.

Aaron Meurer

On Tue, Mar 5, 2013 at 11:11 AM, G B <[email protected]> wrote:
> Just following up with more information--  I get the feeling this is
> different than Issue 1696. I get this behavior, all of which I find
> unexpected:
>
> In [1]: from sympy import *
>
> In [2]: from sympy.abc import x
>
> ## I would expect this to return S(1) without needing to evalf:
> In [3]: integrate(Heaviside(x),(x,-1,1))
> Out[3]: Integral(Heaviside(x), (x, -1, 1))
>
> In [4]: integrate(Heaviside(x),(x,-1,1)).n()
> Out[4]: 1.00000000000000
>
> ## I would expect this to return Rational(1,2), strangely it doesn't even
> return an
> ## unevaluated integral, it seems certain the answer here is precisely zero.
> In [5]: integrate(Heaviside(x-Rational(1,2)),(x,-1,1))
> Out[5]: 0
>
> ## I would expect this to return S(1), what I get is far more complicated:
> In [6]: integrate(Heaviside(x-S(1)),(x,-1,2))
> Out[6]: -meijerg(((2, 1), ()), ((), (1, 0)), 1) + meijerg(((2, 1), ()), ((),
> (1, 0)), 2)
>
> ## ...but evaluates correctly
> In [7]: integrate(Heaviside(x-S(1)),(x,-1,2)).n()
> Out[7]: 1.00000000000000
>
>
> I get correct results spot evaluating Heaviside(x-Rational(1,2)) at various
> points.  Is the problem in integrate?
>
>
> On Tuesday, March 5, 2013 12:43:11 AM UTC-8, G B wrote:
>>
>> Maybe this is a symptom of:
>> http://code.google.com/p/sympy/issues/detail?id=1696
>>
>> but this command:
>> integrate(Heaviside(x-0.2)-Heaviside(x-0.5),(x,0.,1.))
>>
>> returns zero for me.
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to