0

Let there be an event space ES. Let there be some sets of objects OS[]. The probabilities of selecting any object are mutually disjoint.

Now, assume that the size of each set is based on a number X[i] assigned to it. The size of each set rises exponentially with that number.

The base (B) used for exponentiation could be the Euler's number (e), due to its nice properties, but let's assume that, that might not be the case.

Now, we are after calculating the probability of selecting any member of a selected set, at random, while keeping in mind that the arity of each set might be very large.

After the sequence of probabilities is known it's used to compute P[i]*(C).

I wonder if this could be optimized/approximated for very large exponents i.e. computed with low memory consumption i.e. implemented.

Related question I found is here still they seem to tackle only opposite probabilities.

//  Numerical example:

// A,C - constants, natural numbers
//exponents
        X[1] = 3432342332;
        X[2] = 55438849;
        X[3] = 34533;
//probabilities
        P1 = A^X[1]/(A^X[1]+A^X[2]+A^X[3]);
        P2 = A^X[2]/(A^X[1]+A^X[2]+A^X[3]);
        P3 = A^X[3]/(A^X[1]+A^X[2]+A^X[3]);

//Results
R1 = P1 *C;
R2 = P2 *C;
R3 = P3 *C;

Excel would fail when exponents are larger than few hundreds.

Vega4
  • 969
  • 1
  • 11
  • 25
  • Can you add a numerical example? It'd sure help. – Stratubas Jan 23 '20 at 08:03
  • @Stratubas I've included an example. – Vega4 Jan 23 '20 at 08:08
  • 1
    "The reason why I'm using exponentiation is that I need an increase in exponent to lead to exponential change in shares" can you explain this more thoroughly or add an example for this? Maybe you can get the same results with different calculations – Stratubas Jan 23 '20 at 08:20
  • I don't understand the meaning of *a share in this natural number (C)*, nor the relationship between this sentence and the equations. – Damien Jan 23 '20 at 09:59
  • 1
    @Damien, I've refactored the entire question. – Vega4 Jan 23 '20 at 11:02
  • I have a problem with the equations now. The `P[i]` are calculated from the `R[l]`, i.e. from the `P[i]` ... – Damien Jan 23 '20 at 11:54
  • @Damien, sorry, there was a mistake in sample equations; – Vega4 Jan 23 '20 at 12:04
  • 1
    What sort of precision are we talking about? At first glance, if P1 is a 64 bit float, then the answer is P1 = 1/3 for A = 1 and P1 = 1 for A >= 2. The reason for the second result is that A^(X[1] - X[2]) is a big number for A >= 2, so that A^X[1] will be much larger than the remaining parts in the denominator and the probability will be essentially 1. Or do I miss something? – Andrei Jan 23 '20 at 12:45
  • "We have 3 items. We cut each item into A pieces, then each piece into A pieces etc, X[i] times for each item. We gather the pieces and select 1 at random. What are the odds that the selected piece originates from a given item? If each item belonged to a different person, and we pay C currency units to the person our piece belonged to, what's the expected profit of each person?". Is that a correct analogy? What is your practical application? The exponents seem too big to me for anything realistic. – Stratubas Jan 23 '20 at 14:34
  • How about dividing nominator and denominator by the same number? F.e. `P1=1/(1+A^(X2-X1)+...)` if you divide by `A^X1`. You could use A^max(X1, X2, ...) as a divisor, or any other suitable number to keep exponents in range. – Severin Pappadeux Jan 23 '20 at 17:51

1 Answers1

0

So you have a number a>1, an integer array B of n elements, and for each i, you are to calculate a^B[i] / (a^B[1] + a^B[2] + ... + a^B[n]) .

Let C[i] = B[i] - max(B[1], ..., B[n]). Then you calculate a^C[i] / (a^C[1] + a^C[2] + ... + a^C[n]). Since all elements of C are now non-positive, you don't care about overflow.

xashru
  • 3,400
  • 2
  • 17
  • 30
user31264
  • 6,557
  • 3
  • 26
  • 40