Skip to content

Simple program (for a school project) which finds volume of an n-ball in n-dimensions as a ratio of a n-box (sides of equal length, i.e square in 2-dimensions and a cube in 3-D)

Notifications You must be signed in to change notification settings

kookieBE/n-ball_Volume_n-dimensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Finding the ratio of an n-ball to an n-box in n-dimensions

I created this simple program for as my senior math project as I was interested in learning about higher spatial dimensions and it was also an excuse to practise some coding (albeit simple coding) as I want to become competent at coding. I have been interested in doing an exploration on 4 spatial dimensions since I watched a video on 4-D toys (https://www.youtube.com/watch?v=0t4aKJuKP0Q&ab_channel=Miegakure) which helps our 3-D minds visualise 4-D objects. One key concept which the video raises is us 3-D creatures seeing a 4-D object is pretty similar to a 2-D creature seeing a 3-D object: both see a cross-section or snapshot of the object and as the object moves through its respective higher dimension the snapshot that the creatures see appears to shrink, grow, or disappear alltogether. An example of this in our world is the MRI machine, which creates many 2-D snapshots of a person's head and enables doctors to slide through the snapshots to create a pseudo-3-D-object. We could, in concept do the same with a fourth-dimensional object by creating third-dimensional slices of the object, and that is essentially what the 4-D Toys are in the video.

For the Exploration itself, I found it difficult to find a topic which which was both interesting and achievable which was related to 4-D, however this question was simple enough to produce data which could be used to verify the equations for volume of an n-ball (http://www.sjsu.edu/faculty/watkins/ndim.htm).

This program takes a value 'n' (the number of dimension) finds the ratio of the volume of a unit n-ball (where the surface of the ball is always 1 unit away from the origin) as a ratio of a n-box (sides of equal length, i.e square in 2-dimensions and a cube in 3-D). The program starts by creating a pre-determined number of points with n co-ordinates between -1 and 1 (e.g. P = (0.452,0.761,0.905)) and are stored in an array variable which essentially acts as a list of each of the points. This could be considered to be 'pinging' different points inside the n-box, like randomly throwing darts at a dartboard, and whether the points land within the n-ball is determined by the distance to the point from the origin. In order to find this distance the magnitude of a vector drawn from the orgin to the point was found and if this length is less than or equal to one, then the point is within the n-ball. This creates a ratio of space occupied by the n-ball versus the 'empty' space inside the n-box. Finally, as a bonus, the volume of the object can be found by multiplying the ratio (as a fraction) by the volume of the box, or 2n (as the n-ball has a 'diameter' of two units, the n-box has side lengths of two).

About

Simple program (for a school project) which finds volume of an n-ball in n-dimensions as a ratio of a n-box (sides of equal length, i.e square in 2-dimensions and a cube in 3-D)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages