3-dimensional Array and assignment of an additional variable with python and numpy -


i want create 3 dimensional array standard distance 1 in each direction, receive, x=10; y=10; z=10; 1000 cells, example. in next step, want assign additional variable "e" each cell worth consist of gaussian distribution mean 1 , variance 0,1.

i have tried create multidimensional array using:

import numpy np x = np.array([[range(11)],[range(11)],[range(11)]],dtype=int) 

aswell as:

x,y,z = mgrid[0:11, 0:11, 0:11] 

but not know if kind of type looking , how add variable each cell of it.

i pretty new programming , python. additional modules want use numpy, scipy , matplotlib.

thanks help!

best regards.

import numpy np e = np.random.normal(size=(1000, 1000, 1000)) * 0.1 print(e.shape) # (1000, 1000, 1000)  print(e.var()) # 0.0100944667935 

this creates 3-dimensional array, elements random variates sampled normal distribution (mean 0, variance 0.1).

i don't understand first part of question. can give small concrete example of values want in array?


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -