sphvol=: (1p1&^%!)@-:@] * ^
   1 sphvol 3
4.18879
   1 sphvol i.7
1 2 3.14159 4.18879 4.9348 5.26379 5.16771

Left argument is the radius of the "n-sphere".

Right argument is the number of dimensions.

I put "n-volume" in quotes, because if the dimension is 2 (for
example), the "n-volume" is what we call the area of the circle. (And
if the dimension is 1 that "n-volume" is the length of a line
segment).

Anyways, I stumbled across this and thought it might be interesting
for someone else.

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to