RE: Re: Bug in multiple integrals with delta function
- To: mathgroup at smc.vnet.net
- Subject: [mg90162] RE: [mg90130] Re: Bug in multiple integrals with delta function
- From: "Tony Harker" <a.harker at ucl.ac.uk>
- Date: Tue, 1 Jul 2008 06:58:50 -0400 (EDT)
For what it's worth, using Boole gives the correct answer: g5 = 5!*Integrate[ Boole[x5 >= x4 && x4 >= x3 && x3 >= x2 && x2 >= x1] DiracDelta[t - x5 + x1], {x1, 0, 1}, {x2, 0, 1}, {x3, 0, 1}, {x4, 0, 1}, {x5, 0, 1}, Assumptions -> {0 < t < 1}] Tony Harker ]-> -----Original Message----- ]-> From: Dr. Wolfgang Hintze [mailto:weh at snafu.de] ]-> Sent: 30 June 2008 09:53 ]-> To: mathgroup at smc.vnet.net ]-> Subject: [mg90130] Re: Bug in multiple integrals with delta function ]-> ]-> Hello group, ]-> ]-> I'd like to repeat my question. Could someone please comment. ]-> I'm pretty sure that this is a bug, and what's more: ]-> it's fiendish because it starts to appear only from a ]-> certain value of a "counter" n. ]-> ]-> Thanks for your participation. ]-> ]-> Regards, ]-> Wolfgang ]-> ]-> "Dr. Wolfgang Hintze" <weh at snafu.de> schrieb im Newsbeitrag ]-> news:g3d9me$pse$1 at smc.vnet.net... ]-> > 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 ]-> > ]-> > ]-> ]-> ]->