Is it possible to evaluate a function on a numpy array of points, or do I just need to loop through and compute the value at each point?
Maybe this helps you: http://fenicsproject.org/qa/6374/what-is-the-best-way-to-evaluate-function-in-list-coordinates
It is basically the same question. But it seems that without extra tools a for-loop is necessary to evaluate a function.
Not exactly. I was hoping for some kind of vectorized operation, without any explicit for looping. Right now I'm doing, in 1D:
xx = np.linspace(0, 1, num=100) uu = np.zeros_like(xx) for i in np.arange(0, xx.size): uu[i] = u(xx[i])