Tuesday, December 28, 2010

Mathammer- Correction for the masses

I have been stuck in this snow storm in Georgia, since Christmas eve and I was able to drive around 6pm yesterday night back to Texas. During my 22 hour drive and being awake 36 hours, I had a eureka moment or delusional episode, I don't know yet. When people are figuring out math for certain units to do XYZ they are doing it wrong almost 95% of the time and they are way off.

I had flashbacks of my North Korea Ex Special forces Business statistics teacher screaming at us when messing around with Bernoulli's theorem and dice and how to figure out results correctly or probability correctly.

Lets take the classic example of twin- linked assault cannons vs twin linked Lascannons. Everyone will say Assault cannon is just as good as a Lascannon to penetrate armor.

Let's Break down the normal formula we are going to use Space marines as an example with razorbacks shooting Landraiders AV 14

BS= Ballistic skill in percentage format such as BS 4 = .66 bs 3= .50 and so on

(4/6)+(1-(4/6)(4/6)= .878 time to hit for one shot.

To pen results
.16

(1/6)(2/6)= .05% for a damage result

.878 x .05 = 0.04 or 4% chance for a pen result for one assault cannon shot

BS
.878(2/6) = 29% for a damage result

Now this part would be correct if we were only rolling one single die at a time and that was the only thing we were doing. You can't just add 4% 4 times together to get a result of 16% chance. The reason is because we are rolling dice and even if we add enough shots together we can never go pass 100% chance because no matter what there is still a chance of failing even though it would be very slim. You take the 4% for the assault cannon and take it to the 4th power because that is how many shots it has and you have your correct result and add each power to the 4%.

to the first power = .04
second power = .0016
third power = 0.000064
forth power = 0.00000256
Total result should be around = .0416656 or 4.2% chance

So every time you shot that Assault cannon at an Av 14 or really anything above AV 13 your only going to get a 4.2% chance of doing anything to it and you wonder sometimes why the assault cannon is not performing the way its supposed to for you.

1. ...what?

God help me, this is I like biology and psychology, the meat and mind of people, 'cause I have no way of knowing if you're right or not.

2. really the math field aka book you want is

DISCO

DIScrete COmbinatorial mathematics

3. I've had a similar thought process when it comes to the multiple dice. If you just added percentages of independent dice rolls, then you could get over 100%, and that makes no sense.

Only when the chances are dependent (Well, I could get a 5 or a 6 on one die), not independent (NOT Well, I could get a 6 on the die or that one), do you add. Otherwise multiply away. Do not consider the dice rolls to hit and to wound to be dependent of one another, only consider them dependent if you are using the same die for the same purpose.

4. The Antipope from 122nd Cadian has done a post on the same topic.

And here is a calculator... not much use when playing games unless you have a smart phone with interwebz access.

http://stattrek.com/Tables/Binomial.aspx

Messanger

5. i might be missing something, but when i use the calculator here: http://www.stattrek.com/Tables/Binomial.aspx

i put my chance as 0.04 (4%) number of trials as 4, with one success, i get 15% chance of killing with this assault cannon... did i miss something?

6. yeah, Pat

Your putting in .04% chance when you need to put a result for destruction which would be .04 times .33 which is .0132

It should give you a result of 5% roughly which is correct I am off from rounding errors as I was doing quick math.

7. Messenger of death thank you for the great link and its also nice to know that my math checks out and I am not going crazy at times!

8. Pat also before I forget the reason is why because you have to have a yes or no answer or true/false . You have to go a step further to included the destruction result in some format. that is why you use the .0132

9. I assume you are saying to multiply by 33% because of the rolling 5 or 6 on the damage table? but i thought we are just talking about getting the chance to roll on the damage table, as in penetrating. so an assault cannon with 4 shots has a 15% chance to get a roll on the damage table, which would be the same kind of form result as to the 29%?

10. By my math each TLAsC shot has a 1.5% chance of destroying an av 14 vehicle. Its simply cumulative as each shot is independent for all intent and purposes. It doesn't matter that they are rolled together, or rolled one at a time.

Also I might just be tired, but I am pretty sure your TLLC hammer is wrong. On a 6 you have a 50% chance of destroying the vehicle (pen), on a 5 you have a 16.6% chance (glance). This means you have a 9.2% chance on a single shot basis. This is due to AP1. Its similar to your figures but you obviously didn't do the math properly or consider AP1.

"You can't just add 4% 4 times together to get a result of 16% chance. The reason is because we are rolling dice and even if we add enough shots together we can never go pass 100% chance because no matter what there is still a chance of failing even though it would be very slim."

Its an average. Thats what mathhammer is about. You -can- have over 100%. Obviously.
I have 20 die, lets say they have a 0.66 chance to hit, 0.66 chance to wound, and the squad of models has a 4+ save (0.5 x wounds caused for average dead). Zomg 4.3 dead aka 430%.
Its still only an average, and yes like you said none could die if someone rolls twenty ones, but then someone could also roll 20 6's and then the figures change again.

Thats why mathhammer is only a guide.

Pat is actually correct.
I would suggest more rest breaks when driving, keeping your fluids up, and lots of healthy brain food.

On the bright side you had one thing right: "When people are figuring out math for certain units to do XYZ they are doing it wrong almost 95% of the time and they are way off."

11. To correct myself really quickly, since I forgot LC aren't AP 1, it actually has a 14% chance to pen, and a 4.8% chance to destroy an AV14 vehicle.

12. Kris,

I hate to say your incorrect and I had to double check and even go through with a proof and run it through the laws.

Single results for a Twin linked Assault cannon

88% to hit
16% to Rend
33% to get a 5 or 6 on a rend.

(.88)(.167)(.33)=0.0484968 or 4.8% chance on the Pen table. Run that result through Bernoilus proof and you get the 15% chance that Pat is talking about but I am going one step further and see what the chance of is actually destroying.

so 0.0484 *.33=0.016003% or 1.6% because 5 or 6 will destroy the Land raider. Run that through the stat calc to make it easier and it gives you around 5 to 6% which is where I ended up but I had rounding errors at the start which caluclates for the lower result.

Hits 87% or 88% of the time

(.88)(.167)= .1496 * .33 for destroy result equals the .048% that your talking about.

So you have a TL Las Cannon at 4.8% chance to destory or the Twin linked Assault cannon at 1.6% which indicated the Las cannon is a better buy for blowing up a land raider which was my point by a significant amount.

Now that I had sleep I see that I skipped over two steps and didn't even elaborate on them with my post.

13. no problem, i am just trying to make sure i understand.

14. This comment has been removed by the author.

15. its alright, I wasnt as clear on my steps as I should have been.

16. "So you have a TL Las Cannon at 4.8% chance to destory or the Twin linked Assault cannon at 1.6% which indicated the Las cannon is a better buy for blowing up a land raider which was my point by a significant amount."

That would be true if the Assault Cannon was a Heavy 1 Weapon, but it shoots 4 times.

The "startrek.com"-Calculator tells us correctly:

If the chance for a destroying result are 1.6% for a single Assault Cannon shot, for 4 shots the chance of getting at least 1 destroying result are 6.24%. So actually better than the Lascannons 4.8%.

17. Sry, i deleted my first comment, because after reading it again it seemed a bit arrogant.

18. yes, i would like for you to show the 'small steps' helps me organize my thoughts.

19. This comment has been removed by the author.

20. Grrrrrrrr... the system really seems to have problems with longer posts...Another try in three parts:

"yes, i would like for you to show the 'small steps' helps me organize my thoughts."

Ok, then i will try. I hope its not toooo small stepped but i like to think simple ;)

Lets take the example from the inital text, the chance of a TL Assault Cannon to score a penetrating hit on a LR.

First calculate the chance for a single shot:
roll hit (with TL): (4/6) + (2/6 * 4/6) = 0.8888
roll a 6 on "to wound" roll: (1/6) = 0.166666
roll a 3 on the extra rending D3 : (1/3) = 0.333333 %
gives: 0.8888 * 0.16666 * 0.3333 = 0.4935 ~ 0.5
So a single shot from the TL AC has a 5% chance of scoring a penetrating hit (Darkwynn rounded this down to 4%). And therefore an 95% chance of not scroring a penetrating hit. ;)

I will call the chance for penetrating p = 0.05
and the chance for not penetrating n = 0.95

Now lets see the cases for firing 1 to 4 shots.

1 Shot
-------
Easy enough. ;)
Chance for 1 pen: p = 0.05 -> 5%

-to be continued-

21. 2 Shots
--------
Now you have to count possible outcomes. In the case of 2 Shots there are 4:
a) both shots penetrate (pp)
b) first shot penetrates, second does not (pn)
c) first shot does not penetrate, second does (np)
d) both shots dont penetrate (nn)

The propability of each of this cases can be calculated by multiplying the chances for the shots.
a) p * p = 0.0025 -> 0.25%
b) p * n = 0.0475 -> 4.75 %
c) n * p = 0.0475 -> 4.75 %
d) n * n = 0.9025 -> 90.25 %

As you can see the propabilities nicely add up to 100%, as exactly one these outcomes has to occure.

So what is the chance to score at least 1 penetrating hit ?
Case a) leads to 2 penetrating hit, cases b) and c) each lead to 1 penetrating hit. And as it doesnt matter whether the first or second shot does the pen. you can just add up the propabilities.

0.25% + 4.75% + 4.75% = 9,75% chance of getting at least 1 penetrating hit with 2 shots.

3 Shots
--------
A bit more complicated, now there are 8 possible outcomes.
a) All shots penetrate (ppp)
b) All but first shot penetrate (npp)
c) All but second shot penetrate (pnp)
d) All but third shot penetrate (nnp)
e) Only first shot penetrates (pnn)
f) Only second shot penetrates (npn)
g) Only third shot penetrates (nnp)
h) No shot penetrate (nnn)

propability for case a) p*p*p = 0.000125 -> 0.0125 %
for b),c) and d): p*p*n = 0.002375 -> 0.2375%
for e),f) and g): p*n*n = 0.045125 -> 4.5125%
for h): n*n*n = 0.857375 -> 85.7375 %

As b),c) and d) lead to the same result you can add them up (or take the chance times 3).
Same for e),f),g)

chance for scoring 3 pens: 0.0125%
chance for scoring 2 pens: 3 * 0.2375% = 0.7125%
chance for scoring 1 pen: 3 * 0.135375-> 13.5375%
chance for scoring 0 pens: 0.857375 -> 85.7375 %

So chance for at least 1 penetrating hit with 3 shots is 14.2625 %

22. 4 Shots
--------
Now there are 16 possible outcomes.
1 leading to 4 pens: pppp
4 leading to 3 pens: pppn,ppnp,pnpp,nppp
6 leadint to 2 pens: ppnn,pnpn,pnnp,nppn,npnp,nnpp
4 leading to 1 pen: pnnn,npnn,nnpn,nnnp
1 leading to 0 pens: nnnn

Propabilities are:
for 4 pens: p*p*p*p = 0.00000625 -> 0.000625%
for 3 pens: 4*p*p*p*n = 0.000475 -> 0.0475%
for 2 pens: 6*p*p*n*n = 0.0135375 -> 1.35375 %
for 1 pen: 4*p*n*n*n = 0.171475 -> 17.1475%
for 0 pens: n*n*n*n = 0.81450625 -> 81.450625 %

Chance for getting at least 1 penetration with 4 shots is therefore 18,54375%

So it is true that it is not correct to simply add upp the chance for a single shot (5%+5%+5%+5% = 20%), but it is not such a bad approximation.

23. Nice Freak, you broke down all the combinations of it. Now lets set them all in permutations for only a correct set order and do it :P

J/K

I would agree its not a bad approximation for a single shot like in this instant but lets say we are going to have 30 ork boys assault 10 marines and we want to firgure out the results. Instead of 4 shots now your looking at what 40 attacks off the top of my head and the gap error gets wider let alone what base number you are going to use at the start.

Should firgure out a formula for this.

(Combinations)*(Probility of a single result^number of success that result)(1- Probability of a single result on one trail)^number of trails or attacks - number of success that result

so there fore you replace probility of a single result with a forumla to calulcate BS and Toughness result

which should be if then forumla which would be really long.

24. I think its so much easier to consider multi-shot success for affecting vehicles in terms of NOT succeding with all those shots -- then simply taking this result from 1. Going through all the permutations is just busy work.

So
1-(1-Chance of success of 1 shot)^ Number of shots

For twin linked AC against AR14
1-(1-(tl chance to hit at BS3 * rend roll of 6 * d3 result of 3 * either wreck result)^ 4 shots for AC =
1-(1-(8/9*1/6*1/3*1/3))^4 = ~0.0642 or 6.42%

Thats the accurate, simple way to do the calc if going for very precise comparisons. Also avoids rounding errors by using whole fractions. If on the table, you get close enough by just multiplying single chances.

BS
.878(2/6) = 29% for a damage result"

the problem i had with this was that to pen with a lascannon you get 1/6th. while you do get 29% for a damaged result, we need to check apples and apples to compare.

twin Lascannon you get a roughly 14.5% chance to pen
Using the above math a twin autocannon nets you a 18% chance,.. which are roughly equivalent as neither is significantly better than the other.

I find it ironic that the lascannon is better at taking out light armour (10-12) assault cannon is better for heavy armour (13-14) since most people take and shoot lascannons at heavy armour, assault cannons at light armour and troops.

26. You corrected me only to make a new mistake....
Although at least this time your TLLC math was correct.
As someone else stated the AssC has 4 shots.

No one bothers using the indepth method of figuring out results because as I said you are looking for a quick and rough comparison of average results.
There is no reason to use a hugely complicated set of equations when you in the end are dealing with probability, which as these far more complicated equations point out can have varying vastly different results.

27. Catching up on Christmas blogging.

> (4/6)+(1-(4/6)(4/6)= .878 time to hit for one shot.

This is wrong, or some sort of missing parenthesis "new math" I'm not familiar with.

The chance to hit is 32/36 for TL BS4, which is easily visualized in 6 x 6 matrix. Additional probabilities are slightly harder to visualize matrices with 3, 4 or more dimensions, but that's why we all went to college, right?

28. not new math, just simpler math. The first dice has not relation to the second dice, therefore a matrix or decision tree isn't used. If you use a binomial distribution and calculate the chances of getting 1 right out of two trials with a chance of success of 0.66667 (4/6) you will get a 88.88% which is very close to the 'new math' you are having a problem with.

29. Pat, he's got it at .878, not .888, that's the problem I had with it.

If you make a grid of 36 squares (first die on the X axis, second die on the Y) you can use that as a much easier shorthand. First die is 3+, so that "covers" 24 squares on the grid as success. Second die is 3+, and that covers an additional 8.

To me anyway, counting up squares on a grid of 36 and dividing is much easier than computing a binomial distribution, and gives the same result: 32/36 = 88.88%

30. that must be a rounding issue, then again, the difference between .878 and .888 would be rather insignificant if you are trying to get a feel for what is better. The assault cannon vs. lascannon deal was inconclusive in my opinion.

31. RealGenius, I believe there may have been a dropped parenthesis in the equation. I believe it should be 4/6 + (1 - 4/6) * 4/6, or 2/3 + 2/9, which is .666 + .222 or .888. I believe it was just a rounding error.

PS: Sorry for posting so late after the fact.

32. also a late comment:

Instead of adding all the "percent to damage" and adding all the combinations taken to up to the power of the number of shots...

Just use:
(percentage of failure) ^ number of shots
subtract this number from 1 and you have the same answer, but done much easier.

33. also, i did a number of graphs of the common Marine anti-tank weapons. It's incredibly interesting to see how the weapons actually fair compared to how good people actually think the weapons are.

Case in point: TL Assault cannon is one of the best mid-armor (11-13) weapons due to the TL, 4 shots and Rending.

you can see some of the work i did a year or two ago figuring out the data here: www.twinlinked.net

34. TL Lascannon
.888 to hit
.167 to pen AV 14
.333 to destroy
4.9%
1 shot
4.9%

TL Assault Cannon
.888
.056 to pen AV 14
.333 to destroy
1.6%
4 shots
1 - ((chance of miss) ^ 4 shots)
6.4%

TL Assault cannons are better than Lascannons at AV 14; it's just that people have too high of expectations.