Hello everyone.(adsbygoogle = window.adsbygoogle || []).push({});

In Mathematica® I want to numerically integrate a function of k variables (k varies) with respect to all of them. Does anyone of you know a way to do that? I tried the following simplified example.

k = 5;

int[x_] := x[[1]] + x[[2]] + x[[3]] + x[[4]] + x[[5]] ; (* My integrand. Of course, together with a and b below, the true version will be defined in terms of k. *)

a = {1, 2, 3, 4, 5}; (* lower limits of integration *)

b = {2, 3, 4, 5, 6}; (* upper limits of integration *)

For[i = k, i >= 1, i--,

y = Table[x[j], {j, 1, i}];

int[x_] = Integrate[int[y], {x, a[], b[]}] /. {x[p_] -> x[[p]]};

]

int becomes now a constant function, which is what I wanted. My problem is that my initial integrand int[x_] is more complicated than the one written in the example and is not analytically integrable, so that I have to use numerical integration NIntegrate instead of Integrate. However, I cannot NIntegrate one variable at a time. Also using the definition with := (int[x_] := Integrate[...]) trying to perform just one numerical estimation at the end is not working. Any ideas to help me with this problem?

Lucio

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica®: performing a varying number of multiple integrals

**Physics Forums | Science Articles, Homework Help, Discussion**