Re: N-dimensional NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg79101] Re: [mg79066] N-dimensional NIntegrate
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 18 Jul 2007 03:04:39 -0400 (EDT)
- Reply-to: hanlonr at cox.net
This provides a cleaner output than my first approach x = ToExpression[Table["x" <> ToString[n], {n, 3}]]; Integrate[f @@ x, Sequence @@ x] Integrate[f[x1, x2, x3], x1, x2, x3] Integrate[f @@ x, Sequence @@ Thread[{x, -Infinity, Infinity}]] Integrate[f[x1, x2, x3], {x1, -Infinity, Infinity}, {x2, -Infinity, Infinity}, {x3, -Infinity, Infinity}] Bob Hanlon ---- Bob Hanlon <hanlonr at cox.net> wrote: > x = ToExpression[Table["x" <> ToString[n], {n, 3}]]; > > Fold[Integrate[#1, #2] &, f @@ x, x] > > Integrate[Integrate[Integrate[ > f[x1, x2, x3], x1], x2], x3] > > Fold[Integrate[#1, {#2, -Infinity, Infinity}] &, f @@ x, x] > > Integrate[Integrate[Integrate[ > f[x1, x2, x3], {x1, -Infinity, > Infinity}], {x2, -Infinity, > Infinity}], {x3, -Infinity, > Infinity}] > > > Bob Hanlon > > ---- mfedert at gmail.com wrote: > > Hi everyone, > > > > I want to define an N-dimensional definite integral---numerical > > integration rather than symbolic. > > > > Eg, > > > > compute integral of f(x) dx > > > > where x can be an N-vector. I want to define the integral for general > > N. (Obviously before evaluating the integral, I'll specify N.) I > > can't think how to define the range of integration in a neat way in > > the general case. Eg if the variables are x_{1}, x_{2}, ... x_{N}, > > how can I specify that the integration range is > > (say) R^{N}? > > > > Something like > > > > NIntegrate[ f(x), {x_{1}, -inf, inf}, {x_{2}, -inf, inf}, ..., {x_{N}, > > -inf, inf} ] > > > > is what I want... would be neat to have x defined as a list or > > something. > > > > There must be a neat way to do this. Sorry for being such an > > amateur. > > > > Cheers, > > MF > > > >