Sum of all possible products when each product has a maximum

vendredi 29 novembre 2013

Hello



I have a set of sets of real numbers greater than 1. Each set can have a different quantity of numbers.

Set A1 {a11, a12,...a1m1}

Set A2 {a21, a22, ..., a2m2}

...

Set AN {aN1, aN2, ..., aNmN}



If I want the sum of all possible products that have one element from each set, that's easy: (a11+a12+...+a1m1)x(a21+a22+...+a2m2)x...x(aN1+aN2+...+aNmN).

But what i interested in is the sum of all possible products that have one element from each set BUT if the product is Higher than K, then the product must be included as K, not as its real value.

Short example:

Set A1 (2,3)

Set A2 (7,9)

K = 20

Usual sum = 14 + 21 + 18 + 27

Sum I am interested in: 14 + 20 + 18 + 20



What's the fastest way to calculate it? is it possible to do this with a neat formula or am I forced to cycle over all combinations?

Thankx



Wentu






via Physics Forums RSS Feed http://www.physicsforums.com/showthread.php?t=725589&goto=newpost

0 commentaires:

Enregistrer un commentaire