Summation with condition

35 Views Asked by At

Can anyone explain how to do the following sum with condition: $$L = \sum_{i=1,w_i\geq0}^M w_i x_i$$

or $$L = \sum_{i=1,w_i\geq0}^M w_i x_i + \sum_{i=1,w_i<0}^M w_i y_i$$

Thanks!