Author Topic: Help I suck at math  (Read 3026 times)

0 Members and 1 Guest are viewing this topic.

Offline Caranfin

  • Full Member
  • ***
  • Posts: 735
  • Karma: 15
  • Gender: Male
Help I suck at math
« on: October 26, 2011, 05:59:19 pm »
Any mathemathically minded individual mind giving me a hand? Let's see if I even manage to explain my problem at all. Ask if you need clarification on anything.

I'm trying to find a formula that returns the probability of getting k amount of the same result with n amount of x-sided dice. So, if k=3, n=10 and x=6 for example, the probability of getting three ones, twos, threes, fours, fives or sixes with 10 6-sided dice. Thing is, the last time I've done any actual math was in upper secondary school, 3 years ago, and even then probability was definitely not one of my strong points. I looked over some of my old math books while visiting my parents earlier this week, and here's what I've got so far:

Using binomial probability, it's easy to calculate the probability for getting k amount of a certain result (for example k amount of ones) with n amount of x-sided dice:

k = amount of same value
n = amount of dice
p = probability of getting a certain value = 1/x
x = the amount of sides on the dice
q = the complement of p = 1-p

P=(n combinations k)pkqn-k

Basically, IIRC, if I want to expand this to cover any value as long as there are k amount of the same (for example looking for k amount of ones or twos or threes etc), I need to repeat this for all the different values. So, the earlier formula times the amount of faces on the dice. But if n≥2k, all of the repetitions contain a bunch of cases where I'd get the required amount of multiple different values. I'd need to remove these duplicates, which seems stupidly complicated.

So, I figured I'd try to do it another way. Basically, take the complement of the binomial probability earlier (1-(n combinations k)pkqn-k), multiply it by itself for the amount of faces in the dice to get the probability of not getting the required amount of ones or twos etc etc, and then take the complement of that to get the probability of getting k amount of any value.

P(k amount of a certain value) = (n combinations k)pkqn-k
P(NOT k amount of a certain value) = 1-((n combinations k)pkqn-k)
P(NOT k amount of any value) = (1-((n combinations k)pkqn-k))x    <- This is probably wrong
P(k amount of any value) = 1-(1-((n combinations k)pkqn-k))x

I have no idea if this logic is faulty at some point, though I suspect it is since I tried it with k=1, n=10, p=(1/10) and got 99,25%. I'm pretty sure that should be 100%. Of course, there could also be a rounding problem somewhere or I might have made a typo both in excel and doing the calculation on paper.

Soooo, anyone want to take a stab at this and tell me where I went wrong?

EDIT: actually, now that I think about it, 100% would definitely not be the right answer for k=1, n=10, p=(1/10). 99,25% seems pretty plausible to be honest. Still, I'd like comments on the logic. I'm totally not sure about this.
« Last Edit: October 27, 2011, 12:07:58 pm by Caranfin »

Offline WereVolvo

  • IRC Love Butter supplier
  • Global Moderator
  • Machinae Prime
  • *****
  • Posts: 3414
  • Karma: 115
  • Gender: Male
  • Volvot ulvoo kuun savuun!
    • My personal site
Re: Help I suck at math
« Reply #1 on: October 26, 2011, 11:26:42 pm »
* WereVolvo takes a look, and runs away trying to keep his head from exploding.

Yeah, math, and specifically probability, is not my strong suit :P
<@Torp> I have seen your melted pussy!



Quote
Real Dwarfs wall themselves in once they are underground, and survive through incest and cat farming.

Offline Tolkki

  • Jr. Member
  • **
  • Posts: 178
  • Karma: 1
  • Gender: Male
  • A bane to evil.
Re: Help I suck at math
« Reply #2 on: October 27, 2011, 08:34:32 am »
This sounds quite logical to me, and I just had the probability course so I should know how to do this.Interesting, you actually need math after school.
Lurkkers gonna lurk.

Offline Caranfin

  • Full Member
  • ***
  • Posts: 735
  • Karma: 15
  • Gender: Male
Re: Help I suck at math
« Reply #3 on: October 27, 2011, 11:48:05 am »
Shocking, isn't it.
It does seem logical, doesn't it. Still, I tested it with k=1 n=1 x=10 and it returns 65,13%, which seems blatantly wrong. Getting a single result of any value on one die with any amount of faces should be 100% unless I'm terribly mistaken. Looking at it now, I might need to dick around with some conditional probability. Oh well, another reason to visit my parents and get free food.

* WereVolvo takes a look, and runs away trying to keep his head from exploding.

Yeah, math, and specifically probability, is not my strong suit :P

This. This is how I feel.

EDIT: I pointed out in the OP where I think I went wrong.

P(k amount of a certain value) = (n combinations k)pkqn-k
P(NOT k amount of a certain value) = 1-((n combinations k)pkqn-k)
P(NOT k amount of any value) = (1-((n combinations k)pkqn-k))x    <- This is probably wrong
P(k amount of any value) = 1-(1-((n combinations k)pkqn-k))x

The result "get k amount of ones" is not independent from "get k amount of twos". Thus a plain multiplication between the different results in this point is fallacious.

So, back to square one then. This is going to be horribly complicated.

P(Get k amount of 1)=P(A)
P(Get k amount of 2)=P(B)
P(Get k amount of 3)=P(C)
P(Get k amount of 4)=P(D)

P(A)=P(B)=P(C)=P(D)=(n combinations k)pkqn-k

The probabilities for each of these are the same, but AFAIK the probability to get any amount of, say, B is linked to the probability of getting some amount of A. If there were only two sides to the die, it would be very simple:

P(A or B) = P(A)+P(B)-P(A and B)

But what the shit do I do when there are four different probabilities to take into account?

Head. Explode.
« Last Edit: October 27, 2011, 12:22:35 pm by Caranfin »

Offline Jack Lupino

  • Worst Dude
  • Moderator
  • Machinae Prime
  • ***
  • Posts: 12941
  • Karma: 62
  • Gender: Female
Re: Help I suck at math
« Reply #4 on: October 30, 2011, 03:54:17 am »
Look, if you're just bad at gambling, you don't need us to re-evaluate your faults

Offline Caranfin

  • Full Member
  • ***
  • Posts: 735
  • Karma: 15
  • Gender: Male
Re: Help I suck at math
« Reply #5 on: November 01, 2011, 10:28:03 pm »
I wish it were for gambling; the math would most likely be quite a bit easier.

Offline Cestus

  • Newbie
  • *
  • Posts: 67
  • Karma: 5
  • rawr
Re: Help I suck at math
« Reply #6 on: November 02, 2011, 11:06:45 am »
I have to admit that i should learn this for exam.. the fact that german is my native language prevents me from explaining my thoughts properly.
So I just give you the website that does it best in german and hope that google doesn't do a mess with it. ;)

http://www.brefeld.homepage.t-online.de/stochastik-formeln.html
Chaos! Panic! Desaster! (my work here is done ~ for pony)

Offline Caranfin

  • Full Member
  • ***
  • Posts: 735
  • Karma: 15
  • Gender: Male
Re: Help I suck at math
« Reply #7 on: November 02, 2011, 11:30:45 pm »
Either I'm failing to understand the page (quite likely, my German is really rusty), or the result of the google translation (kind of likely, though their translation software is pretty sweet), or that page doesn't offer a solution to my problem.

As far as I can see, currently I need to solve the formula for combining the probabilities for the different faces.

Let's say I'm using a 4-sided die

P(A)=P(Get k amount of "1")
P(B)=P(Get k amount of "2")
P(C)=P(Get k amount of "3")
P(D)=P(Get k amount of "4")


I need to solve P(A or B or C or D), where the probabilities aren't independent. If it were just two sides, it would be P(A or B) = P(A)+P(B)-P(A and B), but I don't have a clue what happens if there are more.

It might be something like P(A or B or C or D) = P(A)+P(B)+P(C)+P(D) - ( P(A)*P(B)+P(A)*P(C)+P(A)*P(D)+P(B)*P(C)+P(B)*P(D)+P(C)*P(D)+P(A*B*C)+P(A*B*D)+P(A*C*D)+P(B*C*D)+P(A*B*C*D) )

But seriously. Look at that fucking thing. That's like an equation from R'lyeh or some shit like that.

Hadou

  • Guest
Re: Help I suck at math
« Reply #8 on: November 02, 2011, 11:57:04 pm »
Either I'm failing to understand the page (quite likely, my German is really rusty), or the result of the google translation (kind of likely, though their translation software is pretty sweet), or that page doesn't offer a solution to my problem.

As far as I can see, currently I need to solve the formula for combining the probabilities for the different faces.

Let's say I'm using a 4-sided die

P(A)=P(Get k amount of "1")
P(B)=P(Get k amount of "2")
P(C)=P(Get k amount of "3")
P(D)=P(Get k amount of "4")


I need to solve P(A or B or C or D), where the probabilities aren't independent. If it were just two sides, it would be P(A or B) = P(A)+P(B)-P(A and B), but I don't have a clue what happens if there are more.

It might be something like P(A or B or C or D) = P(A)+P(B)+P(C)+P(D) - ( P(A)*P(B)+P(A)*P(C)+P(A)*P(D)+P(B)*P(C)+P(B)*P(D)+P(C)*P(D)+P(A*B*C)+P(A*B*D)+P(A*C*D)+P(B*C*D)+P(A*B*C*D) )

But seriously. Look at that fucking thing. That's like an equation from R'lyeh or some shit like that.

I haven't really been following this, but looking at that really long side of the equation, wouldn't it end up like a quadratic or something?
[/ignore me, I wasn't really reading this topic anyway]

Offline Caranfin

  • Full Member
  • ***
  • Posts: 735
  • Karma: 15
  • Gender: Male
Re: Help I suck at math
« Reply #9 on: November 03, 2011, 12:45:35 am »
Yeah. It would have exponents of 20 if I used a 20-sided die, as well. But that's not a bad thing.

Um. I thought about this and that horrible goddamn thing might actually be correct. Need to test it still. Here, I made it prettier:

P(1) = P(get k amount of 1)
p(2) = P(get k amount of 2)
P(3) = P(get k amount of 3)
P(x) = P(get k amount of x)

x = amount of faces in a die
n = amount of dice
p = probability of getting a certain value = 1/x
q = complement of p = 1-p

P(1) = P(2) = P(3) = P(x) = (n combinations k)pkqn-k

P(1 or 2 or 3 ... or x) = P(x)*x - ( (2 combinations x)*P(x)^2 + (3 combinations x)*P(x)^3 ... + (x combinations x)*P(x)^x )