Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why is

Integrate[ HeavisideTheta[1 - x^2] DiracDelta[1 - x^2] , {x, 0, 1} ]

It should be HeavisideTheta[0]?

share|improve this question
Try Integrate[HeavisideTheta[a - x^2] DiracDelta[1 - x^2], {x, 0, 1}] to see if you agree with it, then take the limit a->1 in the two directions. – b.gatessucks Aug 20 '13 at 11:55

I think what you want is

Integrate[HeavisideTheta[1 - x^2] DiracDelta[1 - x^2], {x, 0, 1 + $MachineEpsilon}]

This gives


The $MachineEpsilon (or any number > 0) is necessary because you need to integrate across the singularity of the Dirac Delta (i.e. - in a range including at least a little bit above and below it) to capture its behavior as a distribution.

The factor of 1/2 is due to a delta function having a nontrivial differentiable function (like your 1-x^2) as its argument. Wikipedia and other sources have more complete explanations.

share|improve this answer

I do not think the question is asking for workarounds, is it? it is asking why is the answer given is not HeavisideTheta[0]

Since I have to make this as an answer, ok, then my answer is this: It should have, and this is a bug.


$$ \int_{-\infty}^{\infty}f\left( t\right) \delta\left( t-a\right) dt=f\left( a\right) $$

So when $\delta(t-a)$ is under the integral it acts to pull out the value of the function at the point where $t=a$, i.e. where $\delta(0)$

In the example given $\int_{0}^{1}\theta\left( 1-x^{2}\right) \delta\left( 1-x^{2}\right) dx$, when $x=1$ then $\delta\left( 0\right) $, hence the result should be $\theta\left(1-1^{2}\right) =\theta\left( 0\right) $.

But $\theta\left( x\right) $ is not defined at $x=0$

hence Mathematica should have returned HeavisideTheta[0]

Mathematica graphics

share|improve this answer
That's not correct. The site you linked to correctly states that a delta function is a linear functional: you feed it a function, and it acts on that function in the way you described in your first equation. You are not guaranteed to be able to use it you don't integrate over the whole real line. Normally, this isn't an issue because a delta function is zero everywhere except for where its argument is also zero. However, you must integrate over a neighborhood containing that point (i.e. not one of the boundary points). – Jaffe42 Aug 29 '13 at 3:43
Additionally, the factor of 1/2 is correct. While it's true that Mathematica doesn't evaluate the Heaviside, you have to use the rule \delta[g(x)] = \sum _i \frac{\delta[(x-x_i)]}{|g'(x_i)}. – Jaffe42 Aug 29 '13 at 3:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.