Replies

Mar 13, 2018 8 years ago Official
Bug
User Avatar
Segfault

I am consulting with a mathematician, and will make sure this is fixed accordingly.

🐝 ☕ bug (he/him) | your friendly neighborhood code wrangler. stay in the loop! join and check out the latest admin post highlights

Mar 15, 2018 8 years ago Official
Bug
User Avatar
Segfault

I have chosen to change this page to show the probability rather than the odds for the following reasons:

  • Seeing a percentage chance is easier information to understand for most people.
  • Calculating the odds accurately turns out to be quite messy, and I feel this single use case does not justify adding a rational arithmetic library to our code base.
This change was just deployed and should be showing up on the site within a few minutes.

For those who are curious, here's some info on the accurate calculations. For both, I will assume we have n potions, and I will use t[sub]n[/sub] to represent the total number of tickets purchased for potion [i]n, and b[sub]n[/sub] to represent the number of tickets purchased for potion [i]n by the current user.

Calculating the Odds To calculate the odds, you would need to sum (b[sub]n[/sub] / t[sub]n[/sub]) for all n. However, you need to keep them in fractional form while doing so, which is where a rational arithmetic library would be helpful. The resulting sum is then divided by n the number of potions. Your final result would be a rational number written as a fraction m/n. From there, the odds would be equal to m : (n - m).

Calculating the Probability This one is so much easier. Like the odds, sum (b[sub]n[/sub] / t[sub]n[/sub]) for all n, and then divide by n. However in this case it's okay if the number is a decimal form. You can simply multiple it by 100 (and do a little rounding to make it nice) to get your percentage.

🐝 ☕ bug (he/him) | your friendly neighborhood code wrangler. stay in the loop! join and check out the latest admin post highlights

Mar 15, 2018 8 years ago Official
Bug
User Avatar
Segfault

Quote by Speiro
You should be able to calculate the odds just fine with decimals.
This is incorrect. The issue is that we would wish odds to be displayed with whole numbers. That is no simple task. Dividing both sides by the smaller number will not yield two whole numbers unless one of them already divides the other, which is actually rarely the case.

Your method is incorrect because you haven't proved it will result in whole numbers. Dividing each side by the smaller number will rarely work, for instance, try that method with the ratio 5 to 3.5 Divide both by 3.5 and you just get 5/3.5 to 1.

🐝 ☕ bug (he/him) | your friendly neighborhood code wrangler. stay in the loop! join and check out the latest admin post highlights

Mar 15, 2018 8 years ago Official
Bug
User Avatar
Segfault

Anyway, locking as it's been fixed.

🐝 ☕ bug (he/him) | your friendly neighborhood code wrangler. stay in the loop! join and check out the latest admin post highlights

Please log in to reply to this topic.