What is a Prize Payout Calculator and How Can It Help with Variable Inputs?

  • MHB
  • Thread starter btaylor1
  • Start date
  • Tags
    Calculator
In summary, the conversation is about a programmer needing a cash payout calculator for their project. They discuss the variables and provide an example of the payouts. The programmer had previous help but encountered issues with the total amount paid out being more than the payout pool. They share the code and discuss the issue being caused by rounding errors. The solution proposed is to reduce the payout pool by the difference and redo the calculation. The programmer plans to provide screenshots of the setup and results for further assistance.
  • #1
btaylor1
5
0
Hi all,
I am a programmer and in one of my projects I need a cash payout calculator based on upper and lower minimums and variable input.

Here are the variables:
Total amount to payout
Total number of payouts
Set minimum first place payout
Set minimum last payout
"K" to vary the slope of the curve

Example
Total amount to payout is 10000.
Payout is for 15 places.
1st places is guaranteed 4000.
Last payout (15) is 100.

I had someone help "many" years ago, but the total amount paid out was more than the size of the payout pool. Here is the code:

( ^ ) operator is for exponent
K = inK (inK is the K value to modify the slope)
N = pay_places (N=number of places to pay out)
AA = last_pay (AA=base prize minimum)
Z = max_pay (Z=top prize minimum)
D = pool (D=total payout)
Sum = 0
F = Z / AA
BB = F ^ (1 / ((N - 1) ^ K))

loop I = 0 TO N - 1
Sum = Sum + AA * BB ^ (I ^ K)​
end

NewSum = 0

loop I = N - 1 TO 0 by -1
NewSum = NewSum + AA * BB ^ (I ^ K) * D / Sum​
recommend = AA * BB ^ (I ^ K) (This adds up high)
pay_out = round((AA * BB ^ (I ^ K)),1) (but correctly sets hi and lo bounds)
.
. (more code to write out data)
.
end

Thanks in advance for any assistance
Bob
 
Last edited:
Mathematics news on Phys.org
  • #2
btaylor said:
Hi all,
I am a programmer and in one of my projects I need a cash payout calculator based on upper and lower minimums and variable input.

Here are the variables:
Total amount to payout
Total number of payouts
Set minimum first place payout
Set minimum last payout
"K" to vary the slope of the curve

Example
Total amount to payout is 10000.
Payout is for 15 places.
1st places is guaranteed 4000.
Last payout (15) is 100.

I had someone help "many" years ago, but the total amount paid out was more than the size of the payout pool. Here is the code:

( ^ ) operator is for exponent
K = inK (inK is the K value to modify the slope)
N = pay_places (N=number of places to pay out)
AA = last_pay (AA=base prize minimum)
Z = max_pay (Z=top prize minimum)
D = pool (D=total payout)
Sum = 0
F = Z / AA
BB = F ^ (1 / ((N - 1) ^ K))

loop I = 0 TO N - 1
Sum = Sum + AA * BB ^ (I ^ K)​
end

NewSum = 0

loop I = N - 1 TO 0 by -1
NewSum = NewSum + AA * BB ^ (I ^ K) * D / Sum​
recommend = AA * BB ^ (I ^ K) (This adds up high)
pay_out = round((AA * BB ^ (I ^ K)),1) (but correctly sets hi and lo bounds)
.
. (more code to write out data)
.
end

Thanks in advance for any assistance
Bob

Hi Bob! Welcome to MHB! :)

I haven't tried to analyze your formulas, since I do not know what the rationale behind them is.
But am I right to assume the total amount paid out is almost the same as the payout pool?
If so, your problem is likely caused by rounding errors.

Simplest solution would be to reduce the payout pool by the difference and redo the calculation.
 
  • #3
Thank you for the reply.

Yes on the total payout must match the amount in the payout pool.

Depending on the amount of the total pool, the difference in the total of all the calculated payoff /place can be thousands off unless I start messing with "K." I can get it pretty close but then the slope gets very steep from 1st to 2nd.

When I figure out how to attach some images to my posts, I'll get some screen shots of the setup and results window.

Bob
 
  • #4
I like Serena said:
Hi Bob! Welcome to MHB! :)

I haven't tried to analyze your formulas, since I do not know what the rationale behind them is.
But am I right to assume the total amount paid out is almost the same as the payout pool?
If so, your problem is likely caused by rounding errors.

Simplest solution would be to reduce the payout pool by the difference and redo the calculation.

I am attaching two images one from a default setting after importing the total entry$. The other is a balanced payout but had to mess with the smoothing too much. Despite what the smoothing (K) is set at the total payout should always be in balance just with a tighter or bigger spread of payouts below 1st place.

Simplest solution would be to reduce the payout pool by the difference and redo the calculation.

Not possible. The upper and lower payouts and 80% (in this case) are guaranteed. Also, don't forget that all the fields on the left are variables and the user can modify them to what works best for his result.

I don't have to stick with my original code (from the early 90's on Compuserve). If someone comes up with a better solution I'll sure code it to see if it works.

Bob
 

Attachments

  • clip0004.png
    clip0004.png
    9 KB · Views: 57
  • clip0005.png
    clip0005.png
    9.3 KB · Views: 58
  • #5
btaylor said:
Thank you for the reply.

Yes on the total payout must match the amount in the payout pool.

Depending on the amount of the total pool, the difference in the total of all the calculated payoff /place can be thousands off unless I start messing with "K." I can get it pretty close but then the slope gets very steep from 1st to 2nd.

When I figure out how to attach some images to my posts, I'll get some screen shots of the setup and results window.

Bob

If there is too little money in the pool, there is no solution.
And if there is just enough money, you will indeed get a steep slope...
 
  • #6
btaylor said:
I am attaching two images one from a default setting after importing the total entry$. The other is a balanced payout but had to mess with the smoothing too much. Despite what the smoothing (K) is set at the total payout should always be in balance just with a tighter or bigger spread of payouts below 1st place.

Simplest solution would be to reduce the payout pool by the difference and redo the calculation.

Not possible. The upper and lower payouts and 80% (in this case) are guaranteed. Also, don't forget that all the fields on the left are variables and the user can modify them to what works best for his result.

I don't have to stick with my original code (from the early 90's on Compuserve). If someone comes up with a better solution I'll sure code it to see if it works.

Bob

All right, I have just implemented a formula and an algorithm of my own.
I get:
Code:
Place   Calculated
1       100.00
2       100.00
3       100.00
4       100.06
5       100.51
6       102.65
7       110.20
8       131.87
9       185.52
10      304.23
11      544.95
12      1000.00
Total   2880.00

Or alternatively, when optimizing for rounded values:
Code:
Place   Calculated
1       100.00
2       100.00
3       100.00
4       100.00
5       101.00
6       103.00
7       110.00
8       132.00
9       185.00
10      304.00
11      545.00
12      1000.00
Total   2880.00

Would you consider either of them a better solution?
 
  • #7
"If there is too little money in the pool, there is no solution.
And if there is just enough money, you will indeed get a steep slope..."


Then it is up the the director to adjust how many places he will pay and what the top and bottom amounts are.

The number of participants varies per event, the total pool will vary depending how much money is collected, thus dictating how many places and how much he wants to pay. One time he may have 20 and another time 200. On the 20 he may only pay 3 places; on 200 he may pay 30, 40, or 50 places. That's why they can muck around with the figures to get the best payout spread.

I would like to see what you developed. Can the variables be modified to allow for a flatter curve?

BTW, I may have mislead everybody on the needs. As noted on the screen shots, those $$ amounts are the minimums for that place payout. So if the top amount is > 1000 then that would be OK. Same with the minimum last payout.

I really appreciate your time at looking at this.

Bob
 
  • #8
Well, here is the algorithm I used (bisection with a constant "power" curve).
I'm afraid it's in a different language than what you may be used to (C++).

Code:
#include <stdio.h>
#include <math.h>

double calcPrice(int place, int n, double m, double M, double power)
{
    return m + (M - m) * pow((double)place / (n - 1), power);
}

void calcPayout(double payout, double m, double M, int n)
{
    printf("Payout\t%.2f\n", payout);
    printf("Max\t%.2f\n", M);
    printf("Min\t%.2f\n", m);
    printf("Places\t%.d\n", n);

    int NMAX = 200;
    double PAYOUT_TOL = 0.005;
    double ALGORITHM_TOL = 0.00001;

    bool solutionFound = false;
    double a = 0.01;
    double b = 100.0;
    double c;
    double fa = -1;
    double fb = +1;
    double fc;
    for (int N = 1; N <= NMAX; ++N)
    {
        c = (a + b) / 2;

        double sum = 0;
        for (int i = 0; i < n; ++i)
        {
            sum = sum + calcPrice(i, n, m, M, c);
        }
        fc = payout - sum;
        printf("%d\t%f\t%.2f\t%f\n", N, c, fc, (b - a) / 2);

        if ((fabs(fc) < PAYOUT_TOL) || ((b - a) / 2 < ALGORITHM_TOL))
        {
            solutionFound = true;
            break;
        }

        if (fc * fa >= 0)
        {
            a = c; fa = fc;
        }
        else
        {
            b = c; fb = fc;
        }
    }

    if (!solutionFound)
    {
        printf("Bad solution\n");
    }
    else
    {
        printf("Place\tCalculated\n");
        double sum = 0;
        for (int i = 0; i < n; ++i)
        {
            double price = calcPrice(i, n, m, M, c);
            sum = sum + price;
            printf("%d\t%.2f\n", i + 1, price);
        }
        printf("Total\t%.2f\n\n", sum);
    }
}

void main(void)
{
    calcPayout(2880, 100, 1000, 12);
    calcPayout(2880, 100, 1000, 12);
}

To introduce a parameter that influences the curve, you can use:

Code:
double gParameter = 0.0;

double calcPrice(int place, int n, double m, double M, double power)
{
    double parameterToPower = pow(gParameter , power);
    double lastPlaceToPower = pow(n - 1 + gParameter , power);

    double factor = (M - m) / (lastPlaceToPower - parameterToPower);
    double offset = m - factor * parameterToPower;
    return offset + factor * pow((double)place + gParameter , power);
}

void calcPayout(double payout, double m, double M, int n)
{
    ...
}

void main(void)
{
    calcPayout(2880, 100, 1000, 12);
    gParameter = 1.0;
    calcPayout(2880, 100, 1000, 12);
}

The parameter will have to be greater or equal to zero.
 
  • #9
Thank you for the coding. I can handle C++ so I'll translate it and put into procedure to test.

It may be a while but I'll get some feedback to you.

Bob
 

What is a "Prize Payout Calculator"?

A Prize Payout Calculator is a tool used to calculate the amount of money that will be awarded to winners of a contest or lottery. It takes into account factors such as the total prize pool, the number of winners, and any applicable taxes or fees.

How do I use a Prize Payout Calculator?

To use a Prize Payout Calculator, you will need to input the relevant information such as the total prize pool and the number of winners. The calculator will then provide you with the estimated payout for each winner.

What factors affect the prize payout amount?

The prize payout amount is affected by several factors, including the total prize pool, the number of winners, and any applicable taxes or fees. Additionally, some contests or lotteries may have specific rules or regulations that may impact the prize payout amount.

Can a Prize Payout Calculator be used for any type of contest or lottery?

While a Prize Payout Calculator can be used for most contests or lotteries, it is important to note that some may have unique rules or regulations that may not be accounted for in the calculator. It is always best to double check with the specific contest or lottery rules before using the calculator.

Are Prize Payout Calculators accurate?

Prize Payout Calculators use mathematical formulas to estimate the prize payout amount, so they are generally accurate. However, the final payout amount may vary slightly due to factors such as rounding or variations in taxes and fees. It is always best to use the calculator as a general guide rather than an exact prediction.

Similar threads

  • Advanced Physics Homework Help
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
27
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
6
Views
3K
  • Introductory Physics Homework Help
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
2K
Back
Top