How can we translate real-world positions into a computer language? An example would be to simulate a ball bouncing around in a closed box.(adsbygoogle = window.adsbygoogle || []).push({});

How can we say with confidence that the program will represent reality?

This is my current thinking on how to manage space. Any advise or critique would be greatly appreciated!

Thank you very much for your time and thoughts!Code (Text):import numpy as np

import numpy.random as rand

def gen_space(xsize=10, ysize=10, zsize=10):

'''

Create and fill a 3D space with random values on the interval [0,1].

When accessing points in this space, we can visualize like so:

space[:][Y][Z] # Returns (x) at y=Y, z=Z

space[X][:][Z] # Returns (y) at x=X, z=Z

space[X][Y] # Returns (z) at x=X, y=Y

space[:][:][Z] # Returns (x, y) at z=Z

space[:][Y] # Returns (x, z) at y=Y

space[X] # Returns (y, z) at x=X

space[X][Y][Z] # Returns value at the point (X, Y, Z)

Returns: space, [xsize, ysize, zsize]

'''

# space = np.array([[[None] * zsize] * ysize] * xsize) # Safe method

space = np.empty([zsize, ysize, xsize]) # Fast method

for x in range(xsize):

for y in range(ysize):

for z in range(zsize):

space[x][y][z] = rand.random()

return space, [xsize, ysize, zsize]

if __name__ == '__main__':

space, sizes = gen_space()

**Physics Forums - The Fusion of Science and Community**

# How do we simulate 3D space?

Know someone interested in this topic? Share a link to this question via email,
Google+,
Twitter, or
Facebook

- Similar discussions for: How do we simulate 3D space?

Loading...

**Physics Forums - The Fusion of Science and Community**