Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Bug in multiple integrals with delta function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89729] Bug in multiple integrals with delta function
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Thu, 19 Jun 2008 05:42:50 -0400 (EDT)

Consider the following problem: let x1, x2, ..., xn be independent
random variables uniformly distributed between 0 and 1, and let X =
Max(x1, ..., xn) and Y = Min(x1,...,xn).
The problem consists in calculating the distribution function g[n,t] of
the variable Z = X-Y.

In trying to solve this problem in Mathematica starting with small n
and guessing the general formula I found for n>=5 some strange and
buggy behaviour of a multiple integral containing the function
DiracDelta.

I took the following approach

n=2
g2 = Integrate[DiracDelta[t - Max[x1, x2] + Min[x1, x2]], {x1, 0, 1},
{x2, 0, 1}, Assumptions -> {0 < t < 1}]
Mathematica wouldn't do the integral. Hence I tried to help it by
splitting the range of integration thus

Integrate[DiracDelta[t - Max[x1, x2] + Min[x1, x2]], {x1, 0, 1}, {x2,
x1, 1}, Assumptions -> {0 < t < 1}]
1-t

and

Integrate[DiracDelta[t - Max[x1, x2] + Min[x1, x2]], {x1, 0, 1}, {x2,
0, x1}, Assumptions -> {0 < t < 1}]
1 - t

which leads to

g2 = 2(1-t)

n=3
Splitting the range of integration corresponding to x1<x2<x3 we note
that this would give us 1/3! of the whole range. Observing furthermore
that now Max = x3 and Min = x1 we have

g3 = 3!*Integrate[DiracDelta[t - x3 + x1], {x1, 0, 1}, {x2, x1, 1},
{x3, x2, 1}, Assumptions -> {0 < t < 1}]
-6*(-1 + t)*t

n=4, similarly
g4 = 4!*Integrate[DiracDelta[t - x4 + x1], {x1, 0, 1}, {x2, x1, 1},
{x3, x2, 1}, {x4, x3, 1}, Assumptions -> {0 < t < 1}]
-12*(-1 + t)*t^2

We would hence guess the general formula to be

(*)    gk = k(k-1) (1-t) t^(k-2)

But let's continue one step further:

n=5, similarly
g5 = 5!*Integrate[DiracDelta[t - x5 + x1], {x1, 0, 1}, {x2, x1, 1},
{x3, x2, 1}, {x4, x3, 1}, {x5, x4, 1}, Assumptions -> {0 < t < 1}]
10*t^2*(6 - 4*t + t^2)

I don't need to bother you further. Since here is the bug! According to
(*) the result should be
g5ok = 20 (1-t) t^3
The correct result can also be confirmed by a somewhat different method
in Mathematica, viz.

Integrate[Exp[I*w*(Max[x1, x2, x3, x4, x5] - Min[x1, x2, x3, x4, x5])],
{x1, 0, 1}, {x2, 0, 1}, {x3, 0, 1}, {x4, 0, 1}, {x5, 0, 1}];
Simplify[(1/Sqrt[2*Pi])*InverseFourierTransform[%, w, t], 0 < t < 1]
-20*(-1 + t)*t^3

Hence my question: why does the multiple integral works fine for n=2,
3, and 4, but fails for n=5?

Any hint is greatly acknowledged.

Regards,
Wolfgang



  • Prev by Date: Re: Combining pure functions to produce a new pure function
  • Next by Date: Re: Combining pure functions to produce a new pure function
  • Previous by thread: Re: Several diverse questions
  • Next by thread: Re: Bug in multiple integrals with delta function