<< Back to Warzone Classic Forum   Search

Posts 1 - 20 of 22   1  2  Next >>   
One for the Mathemeticians: 3/23/2015 21:28:29


҈ * TeeMee123҈ *
Level 55
Report
I have a maths/strategy problem.
Imagine a map with 2 territories, each owned by a different player.
Player1 (p1) gets Income1 (i1) per turn and p2 gets i2 per turn.
Is there some formula for working out the fewest armies needed stationed at each territory (a1, a2) to prevent a successful occupancy the following turn, assuming the defending player puts no armies in their territory that turn?

It's hard to explain without an example.
Say there has been a great war between two players, joined by a single choke point connection.
They give up on the war and want to make peace.
During the peace declaration, they want to make sure that the other of them can't occupy their territory the next turn, equally they don't want to keep putting armies there as they stopped the war for a reason.
How many armies do they leave behind?

All this assumes no fog, 50% attack/defence kill rate, 0% luck and only one connection between the two players.
You can try to incorporate kill-rate as a variable and percentage luck for extra maths trickiness :P
One for the Mathemeticians: 3/23/2015 21:48:04


szeweningen 
Level 60
Report
Actually the general formula would be very complicated and impractical, because it'd have to incorporate troop stacks and multiple future turns. In general I like to use the term net income for the net gain you have on armies vs your opponent. Suppose your opponent hits your 100 armies with his 100 armies with 0% luck sr, you get 10 net income this turn. If there are no cards involved (often reinforcement cards play a role) then my very practical formula that I use is to check the difference of net income and the difference in income. It has to be >=0, probably >0, because the troop stacks are lower the following turn AND you have to check if that difference is rising. So if I say
N(i)
is the net income on turn
i
, we denote
I1(i)
and
I2(i)
as income on turns
i
and I defend as player 1 I need:
1)
N(1)-(I2(1)-I1(1))>0

2)
N(i+1)-(I2(i+1)-I1(i+1))>N(i)-(I2(i)-I1(i))>0     ; for all i>1


Of course the net income formula has to incorporate luck setting, troop stacks and obviously attack/defense kill ratio. That may sound a bit complicated, but it's actually a very practical way to calculate in game. In 99% of the cases you only need to calculate 2 turns, maybe 3. I'm too lazy to check, but it's possible that with standard settings you only need to check first 2 turns and the rest will follow automatically, but that'd require some precise calculation.



Also, let me use LaTeX on this forum please :P

Edited 3/23/2015 21:49:55
One for the Mathemeticians: 3/23/2015 21:51:37


Genghis 
Level 54
Report


Thank god we have people who know maths like you Sze, otherwise people like me would have to do it. Just a heads-up: Math isn't my fort.


EDIT: Szeweningen Appreciation Week.

Edited 3/23/2015 21:52:22
One for the Mathemeticians: 3/23/2015 22:01:49


҈ * TeeMee123҈ *
Level 55
Report
Thanks!
One for the Mathemeticians: 3/24/2015 01:23:28


Ξ Nanaimo
Level 56
Report
This is unrelated, but last week, my Pre-Calculus teacher showed the class the proof for 1+2+3+4+... = 1/12
Then deducing from that proof, he finds that 1=0 and the whole class has their mind's blown.
One for the Mathemeticians: 3/24/2015 02:01:32


John Smith
Level 59
Report
Could you show us this proof?
One for the Mathemeticians: 3/24/2015 14:57:53


GiantFrog 
Level 61
Report
Not sure if i get you right here sze, but this doesnt look correct to me.


1)

N(1)-(I2(1)-I1(1))>0


2)

N(i+1)-(I2(i+1)-I1(i+1))>N(i)-(I2(i)-I1(i))>0 ; for all i>1

Now first, i am not sure why you use 2 conditions, when you actually only write down 1 (just set it to "for all i >=1" )
Also, with i>1 in your second condition u miss N(2)-(I2(2)-I1(2))>N(1)-(I2(1)-I1(1)),
i am pretty sure you wanted that included.

Also, i dont think these conditions really make sense.
First, i am sure OP was talking about both players having constant income I1 and I2, otherwise anything can happen.
We could easely hurt the first condition, as I1(2) could be signifcantly higher than I1(1) and this way P1 could still defend easely.
I am not making a specific counterexample for this, im sure everyone can make one on his own, that seems pretty obvious to me.

Now, lets say I1 and I2 are constants, your conditions still wont work.
Here i ll give a counterexample:

a(i):= armies the attcer attcs with on turn i
d(i):= armies the defender defends with on turn i

I1=2, I2=0 kr=dr=1
d(1)=100, a(1): 101


N(1)-(I2(1)-I1(1)) = (100-100)-(0-2) = 2 > 0

so none of your conditions are hurt, still P1 cant defend:

101*1=101>100

So, if there isnt something big that i oversee here, your condiotns dont really seem to work.

Edited 3/24/2015 17:22:59
One for the Mathemeticians: 3/24/2015 14:58:52


GiantFrog 
Level 61
Report

Well, so how do the correct conditions look like?

let k be the atckillratio, d the defenderskillratio

When does the defender hold his territory in turn i? obviously he does if:

d(i) > a(i)*k  i>0   (#)


with

d(i) = d(i-1) + I1 - a(i-1)*k
a(i) = a(i-1) + I2 - d(i-1)*d

when starting with the fewest possible armies for the defender, there obviously exists a turn i in which:
d(i) = d(i) + I1 - a(i)*k
a(i) = a(i) + I2 - d(i)*d
as it cant go up for all i, (simply because then there will be a turn in which the a is high enough to achieve a*k > I1 )
and obviously numbers cant go down forever, so we are searching for this fixpoint.



same thing in a Matrix:

|d(i)|	  |1    -k|   |d(i-1)|   |I1|
|a(i)|  = |-d    1| * |a(i-1)| + |I2|     (##)    these are supposed to be vectors and a Matrix

We now want this to converge with i->inf to the fixpoint.
For this we have to find the eigenvalues of our Matrix:

x is eigenvalue <=> det(A-x*I)=0		with I being the Identity

	   |1-x    -k|
<=> 	det|-d    1-x| = (1-x)²-kd = 0
<=>	x1/2 = 1 +/- sqrt(kd)

we know that k,d are elements of [0,1], k=d=0 is pretty trivial (not much happens there)
so we can say k,d are elements of (0,1]	     => 1 - sqrt(kd) < 1
so this is the intresting eigenvalue.

					|d(i)|		 |I1|
(##) converges to the fixpoint when 	|a(i)|   and 	 |I2| are eigenvectors to our eigenvalue.

						|1    -k|
v is eigenvector to our eigenvalue <=>     (	|-d    1|  (1 - sqrt(kd))*I)v = 0 with v = (v1,v2)

leaving out a few steps here, nothing difficult happens, solving the equation gives us : v1 = k*v2/sqrt(kd)



Edited 3/24/2015 15:39:51
One for the Mathemeticians: 3/24/2015 15:01:04


GiantFrog 
Level 61
Report
Now lets check if our eigenvector v doesnt hurt (#):

k*v2/sqrt(kd) > v2*k 	<=> v2/sqrt(kd) > v2 is indeed not hurt as k,d is element of (0,1] => k*d is element of (0,1] => sqrt(kd) is element of (0,1]

as the Eigenspace to our eigenvalue is a vectorsubspace of R^2 

				|d(0)|		 |I1|
(#) will never be hurt if	|a(0)|   and 	 |I2| are eigenvectors to our eigenvalue, as it never leaves the vectorsubspace.


So we now have our conditions: d(0) = k*a(0)/sqrt(kd) and I1 = k*I2/(sqrt(kd)).

Of course I1 and I2 probably hurt I1 = k*I2/(sqrt(kd)), but you always can just check if you at least you do not hurt I1 >= k*I2/(sqrt(kd)),
in which case you are safe for sure

We started by saying that 
d(i) = d(i) + I1 - a(i)*k
a(i) = a(i) + I2 - d(i)*d 	
which actually isnt totally correct because the attacer is the first one to deploy, the defender starts deploying on second turn, so actually its:

d(0) = k*(a(0)+I2)/sqrt(kd)

Still these conditions arent completly correct,
as there are cases in which we leave our vectorsubspace (due to one of our vectors not being an element of our vectorsubspace),
but it still converges due to a compensation of the disturbace by adding (I1,I2) each turn.
The good thing is we found a fixpoint, so if the conditions are not hurt, things defnetly should work the way you wanted it (assuming i didnt make any mistakes)
I wont check in which cases the disturbance is compensated, this should be enough for today.


Edited 3/24/2015 15:42:03
One for the Mathemeticians: 3/24/2015 15:12:01


GiantFrog 
Level 61
Report
formatting is pretty hard in here, ignore those ----, it somehow ignores spaces when its more than 1 in a row
One for the Mathemeticians: 3/24/2015 15:34:55


DanWL 
Level 63
Report
Use code and /code (with the [ and ] brackets) to keep the spaces and other formatting.
One for the Mathemeticians: 3/24/2015 15:37:06


szeweningen 
Level 60
Report
The formatting really hurts, though I don't understand several things:

We could easely hurt the first condition, as I1(2) could be signifcantly higher than I1(2) and this way P1 could still defend easely. (...)
so none of your conditions are hurt, still P1 cant defend


I wrote down the conditions for defense. Obvoiusly If we want conditions for the attacker to succeed we want the opposite to happen.


edit: I wrote it down in 2 separate points since from a practical standpoint in the game we have to count both of them differently, since the second one has to acocount for reinforcement cards, leftovers converging on a specific territory etc. That's why I said that was simplified version.

Edited 3/24/2015 15:39:55
One for the Mathemeticians: 3/24/2015 15:38:12

andy903 
Level 61
Report
Just saw above that you want to know the proof of S= 1+2+3+4+5..... = -1/12 (not positive 1/12 as stated above)

The reason this calculation is so important is that it attaches itself to probably the most important unsolved problem in mathematics for the past few hundred years which is the Riemann Hypothesis which is quite complicated and uses imaginary numbers to try and return the answer zero for the Riemann zeta function. (if you can prove/disprove this theory you win $1 million, just an FYI).

Anyway if you want to know the proof its probably a bit easier than you thought:

so the question is basically:  ∞
                               Σn
                               n=1


SO this is stating that we are adding all the integer numbers up to infinity as shown at the top. To work this out were going to need a few things:

so first of all lets say that S1= 1-1+1-1+1-1+1-1+1............
The answer for this could be either 0 or 1 depending on where you stop it so you take an average of possible answers and find that S1=1/2

Secondly we say that S2= 1-2+3-4+5-6+7-8..........
To work out this we take 2S2 which is obviously 2 lots of what is stated above but we overlpa them to find a solution.

So we do   1-2+3-4+5-6+7)
           +(1-2+3-4+5-6+7......)


As you can see if we add up the rows we get 1-1+1-1+1-1+1-1+1.... or S1 as we called it

So we know that 2S2= 1/2
and therefore S2= 1/4

So know we can work out S
if we do S-S2 we get something like this:  1+2+3+4+5+6.....
                                         -(1-2+3-4+5-6.....)


And if we take the rows as before we can see that you get 4+8+12+16......

As you can see if we divide that by 4 we get back to 1+2+3+4+5..... so therefore the answer to this is 4S

SO know we have the equation S-S2=4S but we know S2 is 1/4
So S-1/4=4S if we then take an S from both sides and then divide by 3 you S= 1+2+3+4+5....= -1/12

This theory is important to lots of mathematics and calculation in various things such as physics and economics. It is also the backbone of string theory which to be true needs 26 dimensions and you get this from 2 base dimensions of matar moving back and forth plus 24 extra dimensions (2*12). basically 12 pops up in a lot of advanced mathematics. This is only a basic proof of this and there are far more complicated proofs about if you want to read further.

Edited 3/24/2015 15:45:21
One for the Mathemeticians: 3/24/2015 15:43:38


szeweningen 
Level 60
Report
so first of all lets say that S1= 1-1+1-1+1-1+1-1+1............
The answer for this could be either 0 or 1 depending on where you stop it so you take an average of possible answers and find that S1=1/2


:D Math jokes, I have to love them.
One for the Mathemeticians: 3/24/2015 15:48:08

andy903 
Level 61
Report
Obviously i didn't come up with this proof but it does kind of worry me that some people base the whole life work on taking a random average because you cant get a solid answer as its convergent. This is all over mathematics at the moment. Another one is that 0! has to be 1 because it must follow the pattern of factorials above it.
One for the Mathemeticians: 3/24/2015 15:54:10


GiantFrog 
Level 61
Report
I wrote down the conditions for defense. Obvoiusly If we want conditions for the attacker to succeed we want the opposite to happen.


But your conditions arent hurt: ( N(1)-(I2(1)-I1(1)) = (100-100)-(0-2) = 2 > 0 )
and still the attacer succeeds: 101*1=101>100
One for the Mathemeticians: 3/24/2015 15:56:44


szeweningen 
Level 60
Report
Ok, now I'm not sure if your last post was a troll post or was it serious... You do realise that any sensible mathematician knows that basically the whole thing you wrote is basically a joke to confuse high school students and maybe 1st year college guys on the entrance? Mostly "proofs" like that are used to explain to students how easy it is to make an error in proving a hypothesis. Also:

(...) that some people base the whole life work on taking a random average because you cant get a solid answer as its convergent. This is all over mathematics at the moment.


No :P Just no, that does not happen in academic world.
One for the Mathemeticians: 3/24/2015 16:05:20


szeweningen 
Level 60
Report
Ah yeah, I misread your post a bit :P It seems I overlooked the most important factor, that you have to hold on turn 1 :P So if we add the condition

(a(1)+I2(1))*kr < d(1)+I1(1)

then this should hold. More less my initial conditions are meant to be sort of an induction step, however I forgot to check the thesis for i=1 :P
One for the Mathemeticians: 3/24/2015 16:09:36


Sephiroth
Level 61
Report
what the hell am i reading
One for the Mathemeticians: 3/24/2015 16:23:38

andy903 
Level 61
Report
*fp* what do/did you study szeweningen
Posts 1 - 20 of 22   1  2  Next >>