Given a closed-form function f(x,y,z), what is the most efficient way to fill up a 3D ndarray arr[z][y][x] with the values of f(x,y,z)?
For example, if I wanted a 3D ndarray arr[z][y][x] with each element taking the value max((x+1)/(y+1), (y+1)/(z+1)), is there any better way to do so than iterating over the array element by element?
arr[x,y,z]. Ideally the indices will be arrays or slices. What kinds of values can your function take? Just scalars, or arrays? In other words can you only set individual elements at a time, or can you set blocks or ranges?ogridarrays. Maybe even try to creat them from scratch. It'll be a good learning step.