I have a function like this:
def foo(v, w):
return sum(np.exp(v/w))
Where v in the beginning is a numpy array and w a number. Now I want to plot the value of this function for more values of w, so I need a function that works for different sizes of vectors. My solution for now is the obvious one
r = []
for e in w:
r.append(foo(v, e))
but I wonder if there is a better way to do it. Also, I want to stay low on memory, so I need to avoid create a big matrix, then applying the function to every value and sum over the columns (the length of v is more than 5e+4 and the length of w is 1e+3).
Thanks