I'm trying to generate a vector [a(1), a(2),...a(100)] where a(i) is sin(i) if sin(i)>0, and 0 otherwise. What I came up with is creating a lambda expression and applying it through numpy.fromfunction, as such: np.fromfunction(lambda i, j: sin(j) if np.sin(j) > 0 else 0, (1, 100), dtype=int) , but this produces an error
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
How can I get around that? Thanks