# Integration over a convex combination of a region: $\int_{\Omega} (w_1 z_1 + w_2 z_2)^{1-\sigma} d (z_1, z_2)$ where $\Omega = \{ z_1 + z_2 = 1\}$

Take $w,z\in R^{n}$. I am interested in integrating (as generically if possible) $$\int_{\Omega}(w \cdot z)^{1-\sigma} d z$$ Where the domain of $\Omega$ is $1$ dimension, and includes the convex combinations of $z$. i.e. $\Omega \equiv \{z | \sum z = 1 \}$

Obviously, for $n=2$, this is easy to rearrange: $$\int_{0}^{1} \left(w_1 z_1 + w_2 (1-z_1)\right) d z_1$$ $$= \frac{w_2^{2-\sigma} - w_1^{2-\sigma}}{(\sigma - 2)(w_1 - w_2)}$$

And the mathematica code is:

Integrate[(w[1] z[1] + w[2] (1 - z[1]))^(1 - \[Sigma]), {z[1], 0, 1}] // FullSimplify


But it is a little harder to cheat like this as $n$ gets larger, and I am hoping for more general patterns. How would I set up the simple $n=2$ example using the convex combination directly? I tried things like:

 Integrate[(w[1] z[1] + w[2] z[2])^(1 - \[Sigma]), {z[1], 0, 1}, {z[2], 1 - z[1], 1 - z[1]}] // FullSimplify


Integration over a convex combination of a region: $\int_{\Omega} (w_1 z_1 + w_2 z_2)^{1-\sigma} d (z_1, z_2)$ where $\Omega = \{ z_1 + z_2 = 1\}$

...but I couldn't get them to work.

-
This will help with generating limits and dummy variables. I'm afraid I don't understand the question enough to help with the integrand. –  Timothy Wofford Oct 9 '13 at 17:31
Thanks. Alas, the link you have doesn't seem to have the bounds dropping a dimension, as my example does. –  jlperla Oct 9 '13 at 17:45
Well, we can always modify that example. Do you have an equation for the limits? Maybe you could throw a Boole[Total[z]==1] in the integrand. –  Timothy Wofford Oct 9 '13 at 17:49
Along the same lines as @TimothyWofford, you might try the appropriate DiracDelta. –  evanb Apr 15 '14 at 17:40

Here we enumerate the all the distinct edges in a fully connected graph (an equivalent problem, I believe). Then we parameterize the edge by {t,0,1} assuming that the direction of integration doesn't matter. Then we integrate over each edge and total the integrals.

n = 4;
z[n_] := ToExpression[ToString[z] <> ToString[n]]
edges=Union@Map[Sort, Permutations[Array[z, n], {2}]];
lines = ReplaceAll[Array[z, n], {#[[1]] -> t, #[[2]] -> (1 - t)}] & /@ edges;
(* h[x_]:=x^(1-\[Sigma]) *)
g[line_]:= h[Array[w, n].line]
Total@Map[Integrate[g[#], {t, 0, 1}] &, lines]


What follows below was an initial answer based on a misunderstanding. I am leaving it because it may be a useful reference.

If I understand correctly, then the limits can be assigned as follows

n = 2;
f[1] := {z[1], 0, 1}
f[n_] := {z[n], 0, 1 - z[n - 1]};
bounds = Array[f, n];
Integrate[(Array[w, n].Array[z, n])^(1 - \[Sigma]),Sequence @@ bounds]


For those who program better than I do, how can we make this faster? for n=3 I get 4.13607 seconds!

n=3;
bounds = Array[f, n];
Integrate[g[Sequence @@ bounds[[All, 1]]], Sequence @@ bounds]


This brings it down to 2.6 seconds for n=3.

z[n_] := ToExpression[ToString[z] <> ToString[n]]

-
Very helpful. But is the first one doing a triangular domain of dimension $n$ rather than of a 1 dimension subspace of the convex combinations?? The Boole[Total[z]==1] mentioned above seems to be the right domain choice –  jlperla Oct 9 '13 at 18:21
@jlperla, Aahh, I see. I did a RegionPlot of Boole[Total[z]==1] and misinterpreted the triangle as the volume underneath, rather than the edges. So, we need to parameterize the edge of this triangle, and do a single integration over the parameter? How many edges are there for n=4,5,etc.? –  Timothy Wofford Oct 9 '13 at 18:26
@jlperla, I have edited to integrate over the edges. –  Timothy Wofford Oct 9 '13 at 19:51
Thank you, I think that does it. –  jlperla Oct 9 '13 at 20:18
@TimothyWofford Could you please complete your answer with a definition for line? Regards. –  chris Apr 10 at 7:18