b = np.empty(a.shape)
b[a < 40] = funcA(a[a < 40])
b[(a > 40) & (a <= 80)] = funcB(a[(a > 40) & (a <= 80)])
b[a > 80] = funcC(a[a > 80])
How can each element of a numpy array be operated upon according to its relative value?