Re: variable dimension of domain of integration
- To: mathgroup at smc.vnet.net
- Subject: [mg115988] Re: variable dimension of domain of integration
- From: Ray Koopman <koopman at sfu.ca>
- Date: Fri, 28 Jan 2011 06:15:06 -0500 (EST)
- References: <ihrb36$8qe$1@smc.vnet.net>
On Jan 27, 12:41 am, Ulvi Yurtsever <a... at b.c> wrote:
> Consider the function $f(n) = \int_{{0,1}^n}
> \sqrt{\sum_{i=1}^{n} {x_i}^2} dx_1 ... dx_n$.
> How would you define a mathematica function
> F[n_] (using NIntegrate) that computes this
> integral over the n-cube? I can think of several
> inelegant solutions; but surely there are neat
> ways of doing things of this sort...
>
> thanks
F[n_] := NIntegrate[Sqrt@Sum[x[i]^2,{i,n}], Evaluate[
Sequence@@Table[{x[i],0,1},{i,n}]]]