I am trying to calculate an integral involving multiple indicator functions, such as:
$$ h(u,v,w) = -\int_0^1 J^{\prime\prime}(s) (I_{(0,s]}(u) - s)(I_{(0,s]}(v) - s)(I_{(0,s]}(w) - s)\, dF^{-1}(s)$$
where $0 < u, v, w < 1$ and
$$\begin{align} J(s) &= 6s(1-s)\\ F(s) &= 1/[1 + \exp[-s]]\\ F^{-1}(s) &= -\log[-1 + 1/s]\\ \end{align} $$
Here is my code:
Js = 6 s (1 - s) (*weight function*)
FDJs = D[Js, s] (*first derivative of Js*)
SDJs = D[FDJs, s] (*second derivative of Js*)
Fs = 1/(1 + Exp[-(s)]) (*Fs*)
Finv = -Log[-1 + 1/s] (*F inverse*)
DFinv = D[Finv, s] (*derivative of F inverse*)
h = -Integrate[
SDJs*(Boole[u <= s] - s)*(Boole[v <= s] - s)*(Boole[w <= s] -
s) DFinv, {s, 0, 1},
Assumptions -> {0 < u < 1 , 0 < v < 1, 0 < w < 1}]
I get some output, but I am not sure if the syntax is correct especially for the indicator function.


BoolewithPiecewise. As the comments under this answer show, MMA does smart things whenBooleandNIntegrateare combined. Maybe it does here too. – Sjoerd C. de Vries Apr 03 '12 at 10:53indicator[a_,b_][x_]as recommended by @R.M but the results are different. Still working on it. – Wayan Apr 03 '12 at 12:04Piecewisevs.Booleand wrong constructions can lead to different results. For example, replaceBoole[x + y < .5] f[x, y]in Heike's example withg[x, y], whereg[x_, y_] := Piecewise[{{f[x, y], x + y < 0.5}, {0, True}}], and you'll see the same set of points being returned with the same time taken. – rm -rf Apr 03 '12 at 15:15