I need something like this
def qqq(i,j):
if i+j>2:
return 0.5
else:
return 0
n=3
dcdt=np.fromfunction(lambda i,j: qqq(i,j)*i*j, (n,n), dtype=int)
but with more complicated qqq. But it leads to the error "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". I know the problem is that function is called once. How can I do such array creation with the "if-elif-else" structure in the function?