# How can I model multiplication of two sets of integers

First a disclaimer, I am a physician and nowhere near a mathematician. I am struggling with a problem in which I want to model a set of equations using a discrete system.

For example I want to calculate a list of totals when a prescription frequency can be $\left \{2,4,6 \right \}$ and the amount can be $\left \{5,10,15 \right \}$. This gives a set of possible totals of $\left \{10,20,30,40,60,90 \right \}$.

My first, naive, solution was to model the set like: $$\text{Factor } n = a + bx \wedge x = \left \{ x \in \mathbb{N}: x \le (c - a) \div b \wedge (a + bx) \mid d \right \}$$ Where $a$ is the minimum value in the set, $b$ is the increment of the set, $c$ is the maximum of the set and $d$ is a dividend, of which the set is a divisor. Thus, I can describe the frequency as: $\text{Factor } n = 2 + 2x \wedge x = \left \{ x \in \mathbb{N}: x \le (6 - 2) \div 2 \wedge (2 + 2x) \mid \infty \right \} = \left \{ 2,4,6 \right \}$.

But what happens when I multiply such a set definition with another set? If there is no maximum, i.e. $c = \infty$, no problem, the resulting set is just a multiple of the multiplication, i.e. $b_{result} = b_1 \times b_2$. And $a_{result} = a_1 \times a_2$ as is $b_{result}$. But, obviously, this is not correct when $c \neq \infty$, or $d \neq \infty$.

There are two possible solutions, either generate the set and use that in subsequent calculations (can get messy) or come up with some sort of equation that can generate the set (the prefered strategy).

What I want to accomplish is that a set of equations like: $total = frequency \times quantity$ and $quantity = runtime \times infusionrate$ can be solved, while disallowing entries that have no solution. For example if $total = 9$ and frequency is a multiple of 1 than quantity cannot be set at 5, thus the equation with the above values would set the dividend of quantity to 9, limiting quantity to divisors of 9.

Any, help will be greatly appreciated, I have been struggling with this for years and there are no practical existing systems that help doctors with prescription calculations like this.

-
It would be easier to understand what the procedure is that you want if you described it explicitly in the form: The procedure will take as inputs this set, and that set, and will produce as output this third set, which is related to the first two in this way. Currently, it is not clear if you want a procedure that takes as input the frequency and amount set, and gives the sets of totals, or a procedure that takes a set of totals, and gives possible pairs of sets of frequencies and amounts. – Vladimir Sotirov Mar 19 '13 at 21:01
@VladimirSotirov Right, that's exactly the issue, I try to model a solution where both is possible, either the input is a set for total with just one element, 9, so the total should be nine, and for frequency the set is {1,3,9}, quantity is limited to {1,3,9} or frequency is set to 3 and quantity can be {5,10,15} so total can be the multiple of 3 and quantity. But also, frequency can be {2,4,6} and quantity {5,10,15}. That's when I run into problems. What mathematical solution describes the multiplication of {2,4,6} and {5,10,15}? Hope this makes my question and what I am getting at more clear – halcwb Mar 19 '13 at 21:13

From my understanding, you have an input of two sets, $S_1$ and $S_2$. For example: $$S_1=\{2,5,6\}$$ $$S_2=\{5,10,15\}$$

My understanding is that you want to compute a set consisting of all unique products between an element of $S_1$ and $S_2$.

Well, we typically don't consider duplicate elements in sets anyway (we use a multiset for that), so if there's a duplicate value created by our definition, we just ignore it. Thus, we can define the product $S_1 * S_2$ as follows: $$S_1 * S_2 = \{a\cdot b : a\in S_1, b\in S_2\}$$

Is this what you're looking for?

-
Absolutely, that's what I want, but I need to compute that set and I am looking for the derivation of a set builder function such that this in turn can be derived by the multiplication of the set builder functions of $S1$ and $S2$. I don't even know where to look for answers to this problem (did a lot of searching, though). – halcwb Mar 20 '13 at 11:18
@halcwb How does one multiply set builder notation? It's not like a number you can multiply, rather a boolean expression combined with a return value... – apnorton Mar 20 '13 at 19:37
Well, frankly, I have no idea. I just thought that if you define a set $S1$ as a multiple of 2 and set $S2$ as a multiple of 3, than you could say that the multiple of $S1$ and $S2$ should be a set with a multiple of 6. And, without any proof or claim that this is mathematical sound, this works when these sets have no limits. But, maybe, I am barking up the wrong tree. – halcwb Mar 21 '13 at 8:05
I think that there are no better solutions than just multiplying each value and check for duplicates. When I find a better answer I will add this to my question. Thanks. – halcwb Mar 25 '13 at 9:59