# Re: [sympy] does this Piecewise integration look right?

```The condition is an And, so it requires both to be true. Thus, it is
only 2 at one value, x=3, which means it doesn't contribute to the
integral.```
```
I'm not really sure how to interpret the Dirac Delta integral. It
seems to me that it should be the same as integrate(DiracDelta(x), (x,
0, 0)), which gives 0.

I think it makes sense, both mathematically and from a practical point
of view, to always make integrals over zero-measure domains equal to
0.

Aaron Meurer

On Fri, Feb 2, 2018 at 6:26 PM, Chris Smith <smi...@gmail.com> wrote:
> I'm also wondering if the following behavior is right:
>
> ```
>>>> Piecewise((1, x < 1), (2, Eq(x, 3) & (y < x)), (3, True)).integrate((x,
>>>> 0, 3))
> 7
>>>> Piecewise((1, x < 1), (2, y < 3), (3, True)).integrate((x, 0, 3))
> Piecewise((5, (y >= -oo) & (y < 3)), (7, True))
> ```
>
> In the first case, the 2nd condition depends on x and y whereas in the 2nd
> case it only
> depends on y...and in the first case since it depends on x and x's range for
> the 2nd expression
> is from 3 to 3 (zero width) it can't contribute to the integration. So is it
> right to ignore the value
> of y?
>
> And what if there were a DiracDelta function there instead of 2 and the
> integration went to 4 instead
> of 3...then there *would* be a contribution...but this is presently ignored
> by the current routine:
>
> ```
>>>> integrate( Piecewise((DiracDelta(x),x<2),(0,True)), (x,-1,1))
> 1
>>>> integrate( Piecewise((DiracDelta(x),Eq(x,0)),(0,True)), (x,-1,1))
> 0
> ```
>
> /c
>
> --
> 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
> 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
> For more options, visit https://groups.google.com/d/optout.

--
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