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

```By definition (e.g.,
https://en.wikipedia.org/wiki/Dirac_delta_function#As_a_measure),
DiracDelta would have integral one over any set that contains 0, even
if that set has only one point.
So one has to ask, when we integrate over (x, a, b), do we mean closed
interval [a, b], open (a, b), or half-open [a, b).```
```
With either of two former choices we run into trouble with additivity
over intervals: the integral of DiracDelta over [-1, 0] plus its
integral over [0, 1] is 2, while the integral over [-1, 1] is 1.
Similarly for open.
(SymPy currently sidesteps this issue by returning answers in terms of
Heaviside(0) which is left undefined.)

So I think we should treat the intervals of integration as half-open:
a <= x < b. Then an interval such as (0, 0) is empty set, and the
integral of anything over an empty set is zero.

I would also say that things like Piecewise with DiracDelta inside are
not necessarily well-defined. Since DiracDelta is not a function, one
should not define an integrand as "something when x != 3, and
DiracDelta when x is 3". By implementing DiracDelta as a function,
SymPy allows some expressions, like DiracDelta(x)**2, which have no
mathematical meaning; and then the output is meaningless too.

>>> integrate(DiracDelta(x)**2, (x, -1, 1))
DiracDelta(0)   # garbage in, garbage 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