Sum of all possible products when each product has a maximum

  • Context: Graduate 
  • Thread starter Thread starter Wentu
  • Start date Start date
  • Tags Tags
    Maximum Product Sum
Click For Summary
SUMMARY

The discussion focuses on calculating the sum of all possible products from multiple sets of real numbers, with a constraint that products exceeding a specified threshold K must be capped at K. The example provided illustrates how to compute the sum for sets A1 and A2, with K set to 20. Participants agree that while a brute-force approach involves cycling through all combinations, strategic selection of sets can optimize the calculation process, allowing for certain combinations to be evaluated collectively based on their maximum elements.

PREREQUISITES
  • Understanding of combinatorial mathematics
  • Familiarity with real number operations
  • Knowledge of algorithm optimization techniques
  • Experience with programming loops and conditional statements
NEXT STEPS
  • Research combinatorial product calculations in Python using itertools
  • Learn about optimization techniques for reducing computational complexity
  • Explore mathematical proofs for bounding product sums
  • Investigate dynamic programming approaches for similar combinatorial problems
USEFUL FOR

Mathematicians, algorithm developers, and data scientists interested in optimizing product calculations across multiple sets of numbers with constraints.

Wentu
Messages
14
Reaction score
2
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
 
Physics news on Phys.org
I don't see how to calculate this without any loops. You don't have to consider all combinations - as an example, if a1*a2*a3 > K and you have 10 sets, you can calculate m4*m5*...*m10 combinations at once as they all give K.
On the other hand, if a1*a2*a3 * (maximal element of A4) * ... < K, you can ignore the limit and calculate all sums as well. Starting the loops with a clever choice of sets could save some time, but that depends on the numbers.
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 43 ·
2
Replies
43
Views
13K
  • · Replies 102 ·
4
Replies
102
Views
11K
  • · Replies 93 ·
4
Replies
93
Views
13K
  • · Replies 20 ·
Replies
20
Views
9K
  • · Replies 67 ·
3
Replies
67
Views
16K