Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15802 > unrolled thread

Re: variable dimension of domain of integration

Started byDaniel Lichtblau <danl@wolfram.com>
First post2011-01-28 11:14 +0000
Last post2011-01-28 11:14 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: variable dimension of domain of integration Daniel Lichtblau <danl@wolfram.com> - 2011-01-28 11:14 +0000

#15802 — Re: variable dimension of domain of integration

FromDaniel Lichtblau <danl@wolfram.com>
Date2011-01-28 11:14 +0000
SubjectRe: variable dimension of domain of integration
Message-ID<ihu8e1$1ke$1@smc.vnet.net>
Ulvi Yurtsever 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

One possibility:

f[n_] := Module[
   {dims,x},
   dims = Array[x,n];
   NIntegrate[Evaluate[Sqrt[dims.dims]],
     Evaluate[Sequence@@Map[{#,0,1}&,dims]]]
   ]

f[4]
Out[20]= 1.1219

Daniel Lichtblau
Wolfram Research

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web