I want to do a multiple integrate with n variables. When I change the value of n, I do not want to rewrite the variables in the integral manually like here:
fn[n_] := Product[x[i], {i, 1, n}];
n = 3;
Integrate[fn[n], {x[1], 0, 1}, {x[2], 0, 1}, {x[3], 0, 1}]
Instead of that, I want to generate the variables in the integral somehow, depending only on n. I have tried the following but it did not work out.
fn[n_] := Product[x[i], {i, 1, n}];
vars = Row[Table[{x[i], 0, 1}, {i, 1, n}], ","]
n = 3;
Integrate[fn[n], vars]
Could you point out how to do that?
”…but it did not work out.”
can you, please, be more specific? While you got your answer (the key being some application ofSequence
), one problem here is the attempted use ofRow
to create the structure thatSequence
assists with generating. There would be many other ways to achieve the same thing, as the answer states…providing more detail/context would improve this question immensely! $\endgroup$