On 2016-09-04 13:06:08 +0000, Einstein said:
I am using a multiple variable summation formula, but I cannot seem to
render it in mathematical text.
The principle is as follows: You have five hundred thousand units, they
can be stored in any sized allotments/partitions, so in theory you
could have five hundred thousand allotments with one unit each (easy)
to fifty allotments of variable potential sizes or one allotment of
five hundred thousand units. The number of allotments is a Rand
function, and the number of units in each allotment is a Rand function
where they add up to the total units precisely.
I do realize this will create extremely high numbers, that is not an
issue, just the formula is of interest to me.
I appreciate any help.
Here�s a possible approach. I�ll illustrate with 10 units and up to 10 allotments.
Suppose Rand chooses 10 allotments. As you said, then there can only be
1 unit in each allotment.
Suppose Rand chooses 9 allotments. Each allotment must contain at least
one unit, so put one unit in each of the 9 allotments. This leaves 10 -
9 = 1 unit to place. Use Rand to choose a number from 1 to 9 and put
that one unit there.
Suppose Rand chooses 8 allotments. Each allotment must contain at least
one unit, so put one unit in each of the 8 allotments. This leaves 10 -
8 = 2 units to place. This can be done in two ways. Either put two
units in a random choice among the 8 allotments or put one unit in a
random choice and the other unit in a second random choice of the 8
allotments. If you want equal probabilities of storage selections, that
second random choice cannot be the same as the first one.
With 7 allotments there will be 10 - 7 = 3 units to place. Here you
have to partition 3:
3 + 0 = 3
2 + 1 = 3
1 + 1 + 1 = 3
and use Rand to choose one of the partitions, then use Rand the number
of times necessary to distribute that partition of units.
One can go on, but you can already see the problem presented by a large
number of units. If you have n units and m allotments, then you must
place n - m = k units. If k is large you must devise a method to
randomly generate one partition out of the many that are possible. That partition itself may contain many numbers, and those units must be
randomly placed as previously illustrated. That might take a lot of
computer time.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)