MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Bug in Mathematica 7.0.1 multiple integration?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116405] Re: Bug in Mathematica 7.0.1 multiple integration?
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sun, 13 Feb 2011 05:50:22 -0500 (EST)
  • References: <iitek5$jij$1@smc.vnet.net>

Am 09.02.2011 08:09, schrieb Scott Hemphill:
> I just observed this in a naive method for calculating the volume of a
> hypersphere.  It works for n = 1..4, but fails for n greater than 4:
>
> Mathematica 7.0 for Linux x86 (64-bit)
> Copyright 1988-2009 Wolfram Research, Inc.
>
> In[1]:= n=5
>
> Out[1]= 5
>
> In[2]:= vars = Table[Symbol["x"<>ToString[k]],{k,n}]
>
> Out[2]= {x1, x2, x3, x4, x5}
>
> In[3]:= lims = Sqrt[Table[1-Take[vars,k-1].Take[vars,k-1],{k,n}]]
>
>                         2              2     2              2     2     2
> Out[3]= {1, Sqrt[1 - x1 ], Sqrt[1 - x1  - x2 ], Sqrt[1 - x1  - x2  - x3 ],
>
>                  2     2     2     2
>>     Sqrt[1 - x1  - x2  - x3  - x4 ]}
>
> In[4]:= args = Table[{vars[[k]],-lims[[k]],lims[[k]]},{k,n}]
>
>                                         2              2
> Out[4]= {{x1, -1, 1}, {x2, -Sqrt[1 - x1 ], Sqrt[1 - x1 ]},
>
>                        2     2              2     2
>>     {x3, -Sqrt[1 - x1  - x2 ], Sqrt[1 - x1  - x2 ]},
>
>                        2     2     2              2     2     2
>>     {x4, -Sqrt[1 - x1  - x2  - x3 ], Sqrt[1 - x1  - x2  - x3 ]},
>
>                        2     2     2     2              2     2     2     2
>>     {x5, -Sqrt[1 - x1  - x2  - x3  - x4 ], Sqrt[1 - x1  - x2  - x3  - x4 ]}}
>
> In[5]:= Integrate @@ Prepend[args,1]
>
> Out[5]= 0
>
> Scott

Hi Scott,

  this must be a bug. Mathematica 8 does this Integral correctly but I 
would recommend
hsv[n_] = 2 Pi^(n/2)/Gamma[n/2]/n
to calculate the hypersphere-volume [1].

If you insist on integration, try integrating from 0 to Sqrt[1-...] and 
multiply the result by 2^n. [2]

Peter

[1] http://mathworld.wolfram.com/Hypersphere.html
[2] http://dl.dropbox.com/u/3030567/Mathematica/hsv7.nb


  • Prev by Date: Re: Nonorthogonal Eigenvectors
  • Next by Date: Re: how to drop ContextPath when printing from a package?
  • Previous by thread: Bug in Mathematica 7.0.1 multiple integration?
  • Next by thread: print issues