mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Math

Reply
 
Thread Tools
Old 2004-02-12, 14:02   #1
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

12CF16 Posts
Default [Hyper]Geometry

If the hypervolume of a hypercube is L4, what is the hypervolume of a hypersphere, and why?

Luigi
ET_ is offline   Reply With Quote
Old 2004-02-12, 14:36   #2
nfortino
 
nfortino's Avatar
 
Nov 2003

3×5×11 Posts
Default

Quote:
Originally Posted by ET_
If the hypervolume of a hypercube is L4, what is the hypervolume of a hypersphere, and why?

Luigi
(Pi)2R4/2. I once did the derivation, but I don't have it on hand (the answer is from memory). I think it comes from rotating a half sphere around an axis allowing it to go into the fourth dimension, and using calculus to find the volume. This is similar to the operation of taking a half circle, and rotating it about the x axis, rendering a sphere. I'll have to work through the details to see if my memory is correct.
nfortino is offline   Reply With Quote
Old 2004-02-12, 14:46   #3
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

12CF16 Posts
Default

Quote:
Originally Posted by ET_
If the hypervolume of a hypercube is L4, what is the hypervolume of a hypersphere, and why?

Luigi
Never mind...

Here is what I found in the meanwhile.

Code:

module common
   public :: initialize,integrate

   integer, parameter, public :: double = 8
   real (kind = double), parameter, public :: zero = 0.0
   real (kind = double), public :: h, volume
   integer, public :: d

contains

subroutine initialize()
   print *, "dimension d?"
   read *, d                         ! spatial dimension
   print *, "integration interval h?"
   read *, h
   volume = 0.0
end subroutine initialize

recursive subroutine integrate(lower_r2, remaining_d)
!  lower_r2 is contribution to r^2 from lower dimensions
   real(kind = double),intent (in) :: lower_r2
   integer, intent (in) :: remaining_d  ! # dimensions to integrate
   real (kind = double) :: x

   x = 0.5*h   ! mid-point approximation
   if (remaining_d > 1) then
      lower_d: do
         call integrate(lower_r2 + x**2, remaining_d - 1)
         x = x + h
         if (x > 1) then
            exit lower_d
         end if
      end do lower_d
   else   
      last_d: do
         if (x**2 + lower_r2 <= 1) then
           volume = volume + h**(d - 1)*(1 - lower_r2 - x**2)**0.5
         end if
         x = x + h
         if (x > 1) then
            exit last_d
         end if
      end do last_d
   end if
end subroutine integrate

end module common

program hypersphere
!  programma originale di Jon Goldstein
   use common

   call initialize()
   call integrate(zero, d - 1)
   volume = (2**d)*volume         
   print *, volume
end program hypersphere
BTW, is there anybody with knowledge of Fortran that could/would translate it into C?
Thank you!

There is more:


Code:
Hyperspheres

A hypersphere is the higher dimensional analogue of a 3-sphere. 
I won't explain this in any detail here, since the explanation
is similar to that given for hypercubes. A 2-sphere is a
 circle. A 3-sphere is what we'd normally call a sphere.

Strange things can happen in the higher dimensions. For 
example, consider the "volume" of a hypersphere. For 
simplicity, let's take a (hyper)sphere of radius 1 unit. The 
"volume" of a unit 2-sphere (i.e. area of a circle) is pi 
(about 3.1) square units. The volume of a unit 3-sphere is 
4/3 pi (about 4.1) cubic units. A 4-sphere has volume of 
4.9. A 5-sphere's volume is 5.2. Then something wierd 
happens; a 6-sphere has a volume of 5.1 units6. The 
volumes of hyperspheres with larger dimensions than this 
continue to decrease, so that an infinite dimensional unit 
hypersphere would have no hypervolume!

The properties of things in higher dimensions are very 
interesting to consider.
Here is an interesting link that explain it all:
http://linneus20.ethz.ch:8080/1_5_3.html
Especially last paragraph.

Two peculiarities:
We should use Gamma-function
Knuth talked about it in vol. II, section 3.4.1.E(5), TAOCP.

Luigi
ET_ is offline   Reply With Quote
Old 2004-02-12, 14:59   #4
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

32·5·107 Posts
Default

Whops...

Nfortino thank you... your format is surely more easy and readable than what I found!

Though if I read well, Vn(r) = Vnrn ==>

r4(PI/4)2(1/2) = PI2r4/32

Though I trust your formula more than mine

Luigi
ET_ is offline   Reply With Quote
Old 2004-02-12, 15:17   #5
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

32·5·107 Posts
Default

Quote:
Originally Posted by ET_
Though I trust your formula more than mine
And I was right!

There is a typo in the link.

After the sentence "The general formula is given by:", between the third and fourth passage.

Congratulation Nfortino!



Luigi
ET_ is offline   Reply With Quote
Old 2004-02-13, 04:23   #6
dsouza123
 
dsouza123's Avatar
 
Sep 2002

29616 Posts
Default

I believe this is a correct translation into Pascal.

Code:
Program hypersphere;
var
  zero : double;
  h, volume : double;
  d : longint;   

Procedure initialize;
begin
   write('dimension d ? ');
   readln(d);                             // spatial dimension
   write('integration interval h ? ');
   readln(h);
   volume := 0.0;
end;


Function power(num:double;exp:longint) : double;
var
  r : double;
  i : longint;
begin
  if (exp = 0) then
    r := 1.0
  else  
    if (exp = 1) then
      r := num
    else  
      if (exp = 2) then
        r := num*num
      else begin
        r := num;
        for i := 2 to exp do
          r := r * num;   
      end;
end;












Code:
Procedure integrate(lower_r2 : double; remaining_d : longint);
var
  x : double;
begin  
   x := 0.5 * h;                            // mid-point approximation
   if (remaining_d > 1) then begin
      repeat
         integrate(lower_r2 + x*x, remaining_d - 1);
         x := x + h;
      until (x > 1.0);
   end  
   else begin  
      repeat
         if ((x*x + lower_r2) <= 1) then
           volume := volume + power(h,(d - 1)) * sqrt(1 - lower_r2 - x*x);
         x := x + h;
      until (x > 1.0);
   end;
end;

begin        //  programma originale di Jon Goldstein
   zero := 0.0;
   initialize;
   integrate(zero, d - 1);
   volume := power(2.0,d)*volume;
   writeln(volume:0:20);
end.









The original source appears to be Fortran90 or maybe Fortran95.

Last fiddled with by dsouza123 on 2004-02-13 at 04:27 Reason: To correct the display of code.
dsouza123 is offline   Reply With Quote
Old 2004-02-13, 14:53   #7
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

32×5×107 Posts
Default

Quote:
Originally Posted by dsouza123
I believe this is a correct translation into Pascal.
Thank you dsouza123!

Pascal was my first-love programming language

Luigi
ET_ is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How much will hyper threading help primecrusader Hardware 7 2016-09-16 01:51
Prime95 crash with Hyper-threading enabled Laurent Hardware 4 2012-08-07 05:20
Geometry Puzzle davar55 Puzzles 33 2009-07-16 10:10
Geometry cherrycherry Homework Help 5 2007-08-31 00:34
The Geometry of Time mfgoode Science & Technology 4 2006-03-09 03:37

All times are UTC. The time now is 12:56.


Fri Jul 16 12:56:45 UTC 2021 up 49 days, 10:44, 2 users, load averages: 1.46, 1.69, 1.55

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.