Page 1 of 1

Donovans mine formula

Posted: Sat Mar 31, 2012 5:01 am
by FireAge
I was looking into mine hits on donovans and was wondering about an inconsistency (or mistake on my part).
http://www.donovansvgap.com/info/spacemines.htm

They state:
The Probability of Hitting a Mine Over A Given Distance

So how can we calculate the probability of hitting one mine when travelling a given distance (x)? To do this we use a probability concept known as: the binomial distribution. To put it simply, if you have some basic notion of probabilities, it is obvious that chance of a minehit follow a binomial distribution.

The probability of hitting a number x of mines when travelling d lightyears is B(x,d,p) if p is the minehit probability per light year travelled.

The function B is therefore:

B(x,d,p) = (d/x) * (p^x) * ((1 - p)^(d-1))

Where (d/x) = d!/(x!*(d - x)!)
and n!=1*2*...*n
But then in the example for 30 ly, they state:
Assume a 30 light year mine field, with normal configuration p=1% (which means 0.01). We want to know what the probability is of crossing it without minehits:

B(0,30,0.01) = (30/0) * (0.01^0) * ((1 - 0.01)^(30 - 0)) =

= (30! / (0!)*(30 - 0)!) * 1 * ( 0.99 ^ 30 ) =
= (30! / 1 * 30!) * 1 * (0.7397) =
= 1 * 1 * 0.7397 = 0.7397
Note the parts marked in red. Am I missing something, or does this not match?
Seems to me either the formula should be (d-0) or the example should be (30-1).

Re: Donovans mine formula

Posted: Sat Mar 31, 2012 6:32 am
by streu
FireAge wrote: But then in the example for 30 ly, they state:
Assume a 30 light year mine field, with normal configuration p=1% (which means 0.01). We want to know what the probability is of crossing it without minehits:

B(0,30,0.01) = (30/0) * (0.01^0) * ((1 - 0.01)^(30 - 0)) =

= (30! / (0!)*(30 - 0)!) * 1 * ( 0.99 ^ 30 ) =
= (30! / 1 * 30!) * 1 * (0.7397) =
= 1 * 1 * 0.7397 = 0.7397
Note the parts marked in red. Am I missing something, or does this not match?
Seems to me either the formula should be (d-0) or the example should be (30-1).
Forget binomial coefficients, it's much simpler if you want 0 hits.

The probability to move on ly without hitting a mine is 99% = 0.99. The probability to move another ly without hitting a mine is again 99% = 0.99. The probability to move two ly therefore is 0.99*0.99 = 0.99^2 = 0.9801. Thus: the probability to move N light-years without hitting a mine, with a mine hit probability of P%, is (1-P/100)^N, i.e. for your example, 0.99^30.

That is theory. Also see http://phost.de/~stefan/minehits.html for some pretty weird stuff about mine hits in practical Tim-Host.


--Stefan

Re: Donovans mine formula

Posted: Sat Mar 31, 2012 6:42 am
by FireAge
But I'm not interested in just 0 hits, I want to know the chance to get multiple types of hits.
So I was working on an excel array for the computations and it did not match up.

I'll check out your formulas, though ytour calculations are for webmines.
Webmines stop the ship, normal mines slow it down by 10 ly if the techlevel is below spec.
So that kind of changes things a bit :)

Re: Donovans mine formula

Posted: Sat Mar 31, 2012 7:22 am
by streu
FireAge wrote:But I'm not interested in just 0 hits, I want to know the chance to get multiple types of hits.
So I was working on an excel array for the computations and it did not match up.
OK. Since I'm bad at memorizing formulas, I usually derive those on-the-fly.

You want to move D light-years, hit N mines, with mine hit probability P (e.g. 0.01).
[Edit: it said "e.g. 0.99" before, but should be 0.01 of course]

Split your distance into D steps of one light-year, tick N segments. Like this:

Code: Select all

    pass pass hit pass pass hit pass
   (1-P)*(1-P)*P*(1-P)*(1-P)*P*(1-P)
i.e. (1-P)^(D-N) * P^N. No matter how you tick D-out-of-N segments, the probability will be the same for each kind.

How many possibilities are there to tick D-out-of-N segments?
- for the first tick, you have D choices
- for the second tick, you have D-1 choices because one element is already ticked
Thus, there are N*(N-1)*(N-2)*...*(N-(D-1)) possibilities, that's N!/(N-D)!. Since this counts each selection in each possible order, we also have to divide by the number of possible orders, which is D!. Therefore, there are N!/((N-D)! * D!) possibilities.

Thus, the final result is

(1-P)^(D-N) * P^N * (N!/((N-D)! * D!))

To cut a long story short: the "-1" in the original formula is wrong.
I'll check out your formulas, though ytour calculations are for webmines.
Webmines stop the ship, normal mines slow it down by 10 ly if the techlevel is below spec.
So that kind of changes things a bit :)
Things are changed a little because HOST does not move ships in steps of 1 ly. If you're going 40 ly east, 30 ly north, 50 ly total, the ship will not be moved in 50 steps of 1 ly, it will be moved in 40 steps of 1.25 ly.

Fortunately, the accidental implicit "+1" which there is for web mines does not exist for regular mines.


--Stefan

Re: Donovans mine formula

Posted: Sat Mar 31, 2012 7:36 am
by FLETCH
:shock: :suicide:

Re: Donovans mine formula

Posted: Sat Mar 31, 2012 8:30 am
by Rimstalker
@FireAge: Of course, you can also have multiple Webhits in one turn!

Re: Donovans mine formula

Posted: Sat Mar 31, 2012 1:49 pm
by FireAge
Thanks stefan, it confirms my calcs and of course the value prediction of VPA.

How does the host deal with 40 steps of 1.25 ly.
It calculates the chance of hitting a mine for a single step (0.0125 in this case?)
and then does the normal math?

So your example would be:
(1-0.0125)^40 = 0,6045
instead of
(1-0.01)^50 = 0,6050

Because if so, my sheet needs to adapted a bit :)

Re: Donovans mine formula

Posted: Sun Apr 01, 2012 6:32 am
by streu
FireAge wrote:How does the host deal with 40 steps of 1.25 ly.
It calculates the chance of hitting a mine for a single step (0.0125 in this case?)
and then does the normal math?

So your example would be:
(1-0.0125)^40 = 0,6045
instead of
(1-0.01)^50 = 0,6050

Because if so, my sheet needs to adapted a bit :)
Yes, that's precisely how it works.

In particular, the per-step probability is indeed computed as Mine_hit_rate * Step_length_according_to_Pythagoras. This is mathematically wrong (correct would be 1-(1-Mine_hit_rate)^Step_length_according_to_Pythagoras), leading to the effect that there are slightly different probabilities depending on the angle you move. This problem affects web mines more than regular mines, see my article.

It might be noted that PHost works a little different here. It computes the distance to move, a probability distribution for the next way segment, and then rolls a die once to figure out whether a mine is hit or not, and if so, where. It does not move ships in steps of 1 ly. Therefore, it has no angle dependance.


--Stefan

Re: Donovans mine formula

Posted: Sun Apr 01, 2012 7:36 am
by FireAge
And how is the amount of steps determined?
Amount_of_steps = Max(dx;dy)?

I have been flying the recommended angles of 33 and 44 whenever I really needed to fly out of a minefield.
But it's never actually saved a ship, I guess lady fortuna doesn't like people messing with her statistics ;)

Re: Donovans mine formula

Posted: Sun Apr 01, 2012 8:00 am
by streu
FireAge wrote:And how is the amount of steps detemined?
Amount_of_steps = Max(dx;dy)?
Yes.


--Stefan

Re: Donovans mine formula

Posted: Sun Apr 01, 2012 4:26 pm
by Gilgamesh
I think I'll just memorize the general principle that minefields are kinda dangerous....

Re: Donovans mine formula

Posted: Sun Apr 01, 2012 4:39 pm
by streu
Gilgamesh wrote:I think I'll just memorize the general principle that minefields are kinda dangerous....
Good idea. It's also better to remember that minefields destroy each other. No need to remember that PHost solves quartic equations to do that.


--Stefan

Re: Donovans mine formula

Posted: Mon Apr 02, 2012 2:12 pm
by FireAge
Now now, stop showing off your knowledge of Taylor serise :)

I think the biggest problem with PHost is that it's all correct.
That means I can account for everyt\hing, taking me more time :(