# The N Square Law Engineering Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

The principle of concentration, or n-square law, was proposed by F.W.Lanchester in 1914 as a mathematical attempt to describe the effect of concentration of force in battle. Although the original model may not be applicable to modern warfare, where giant pitched battles are no longer fought, the original model gives an intriguing insight into how mathematics has been used to model and predict the outcome of warfare - and in turn greatly influenced the military tactics of the era.

## Aims & Objectives:

To analyse Lanchester's initial laws

To use verify Lanchester's laws against the outcome of a historic battle

To investigate further expansions of Lanchester's laws

To investigate if the model or any expansions are applicable to modelling combat of social animals

## Abstract

The power laws are a set of laws set forward by F.W Lanchester in the height of World War 2. These laws of attrition can be used to model combat in its simplest form. This article first discusses the laws developed by Lanchester. After these laws were introduced other scholars sought to improve the accuracy of the models and this article will look at stochastic approaches to the Lanchester laws. More recently the Laws have thought to have been able to model the behaviour of the combat of chimpanzees and ant species and these shall be discussed also.

## Introduction

The N-squared law set by F.W. Lanchester is the main focus of my attention throughout this project and I aim to discuss and analyse the developments and characteristics of this mathematical tool.

Lanchester provided us with his power laws, the linear law and the square law. The laws are used to model the rate of change of soldiers in respective armies. The linear law can be applied to ancient combat, where armies fought battles with sword and shield.

Mathematically this can be expressed as:

, (1.1b)

. (1.1c)

Lanchester's square law deals with more modern combat, where the use of guns allows each member of one army to target any member of the other army. The rate of casualties is now proportional to the size of the opposing army. Lanchester's square law can be expressed as:

(1.3)

(1.4)

An extension of the linear law is the application to unaimed (artillery) fire, and guerrilla warfare. For both of these methods the rate of casualties is proportional to not only the size of the opposing army but the size of your army.

This can be described by the equations:

, (1.7)

. (1.8)

Through the use of historical data it can be demonstrated that use of this law can be used to model the outcome of the Battle of Iwo Jima, where U.S. troops assaulted the Japanese.

Some scholars have argued that the linear laws are not accurate enough because we can never say exactly what is going to happen we can only calculate the probability.

One method of doing this is to use Markov chains. We can calculate the probability of one of the sides for a set of given initial conditions using the transition probabilities:

, (2.1)

. (2.2)

And it can be shown that the probability of one side winning for a battle that follows the square law is:

## .

The Power Laws are also said to be able to model the outcomes of battles in nature such as ant territories using the generalised Lanchester equation:

, (3.1)

. (3.2)

(3.3)

We can investigate the application of the laws, and see if the data fits our results.

## An Introduction to Lanchester's Power Laws

In the 19th century F. W. Lanchester devised a series of differential equations that would form the basis of military strategy. During the First World War, Lanchester formed his 'Power Laws' to model the combat between two opposing forces. These laws were the Linear Law and the Square Law.

## Lanchester's Linear Law

The linear law is used to model ancient combat where battles were pitched on great battlefields and two sides met on opposing battle lines, sword against sword and shield against shield. Defending against forces was "positive and direct", to stop a sword one would block with a sword, or shield. As the two armies met, the fighting followed a series of 'duels' with one soldier attacking the soldier opposite him in the formation.Â The change in troop numbers was the ratio of how effective one army was against the other. Let us use an example of a red army and a blue army. Therefore mathematically:

. (1.1a)

Or:

, (1.1b)

. (1.1c)

Where:

b is the number of soldiers in the blue army,

r is the number of soldiers in the red army,

E is the effectiveness of the blue army against the red army,

v is the average accuracy (or efficiency) of the blue army,

u is the average accuracy (or efficiency) of the blue army.

The effectiveness shown here is a measure of the efficiency with which the blue army fights compared to the red army. This is determined by various factors such as weapons, training and morale. It should be noted that sometimes these factors are not easy to express as numerical values.

We can calculate the state equation at a given time to give Lanchester's linear law:

## ,

## ,

## ,

## ,

(1.2)

Where:

b(0), r(0) are the initial sizes of the blue and red army respectively,

b(t), r(t) are the sizes or the blue and red army at time t respectively.

## Lanchester's Square Law

The Square Law is used to model modern combat where each soldier can attack multiple targets and can receive fire from multiple directions. Lanchester determined that the power of such an army is proportional not to the number of units it has, but to the square of the number of units. When we consider modern combat we assume each soldier has aÂ relative fighting value and that for a given time each soldier will kill a certain number of the opposing army, thus indicating his accuracy. Since the fighting is collective, we can therefore conclude the men killed per unit time is the product of the strength of the opposing force and the average accuracy of the opposing force. Expressing the rate of attrition for each army as a mathematical formula gives,

(1.3)

(1.4)

Where:

b is the strength of the blue army,

v is the average accuracy (or efficiency) of the blue army,

r is the strength of the red army,

u is the average accuracy (or efficiency) of the red army,

t is the time.

Using equations (1.3) and (1.4) and the Matlab codes from appendix 1.A, 1.B and 1.C, we can investigate the outcome for various hypothetical situations. For the purpose of this example we shall assume that each of the armies have the same average accuracy of 0.05.

Figure 1. Outcome with initial solider number of: blue army = 10000, red army = 10000, with an equal accuracy of 0.05. This forms a single logarithmic curve and will continue indefinitely to an infinitesimally small number of units until the last man is reached and the graph will have to hit zero.

Figure 1. Outcome with initial solider number of: blue army = 10000, red army = 7500, with an equal accuracy of 0.05.

Figure 1. Outcome with initial solider number of: blue army = 10000, red army = 5000, with an equal accuracy of 0.05.

From these situations it is clear to see that for an equal accuracy, we can see that not only does the bigger force win, it wins by a bigger margin, until a point where the blue army would suffer insignificant losses. This can be seen more noticeably when two armies of 10000 meet, but the blue army is able to split the red army and engage two separate armies of 5000.

Figure 1. Outcome when blue army of 10000 meets a red army of 5000 followed by another red army of 5000. All armies have an equal accuracy of 0.05.

As we can see, it appears to be greatly advantageous to split the opposing army, since there are only around 3000 blue losses to eliminate the entire red force.

Of course, the case where both forces have equal strength and accuracy are going to be very rare, and more often one side will a greater rate of attrition than the opposing force, due to more advanced weaponry or training.

To determine which side will win a given battle, we can solve equations (1.3) and (1.4). Start by eliminating the time variable from (1.3) and (1.4) by dividing one by the other:

(1.5a)

(1.5b)

Since c and k are both constants, we can express (1.5b) as:

(1.6a)

This constant can be interpreted as either, the square of the remaining blue forces after elimination of the reds, or as the minimum size of the red army required to eliminate the remaining blue troops. A third interpretation is that if the value is negative, the modulus of this value is the amount of red troops remaining after eliminating the blue forces.

From this we can say that if blue wants to win, then they should ensure that

## .

We can also form the state equation for Lanchester's square law by performing a definite integration of (1.5a).

(1.6b)

From the system of differential equations (1.3) and (1.4) we can plot a phase portrait to see the stability of the system and the outcome from different initial conditions.

Using Matlab and the codes from appendix 1.D and 1.F, we can produce the image below.

Figure 1. Phase portrait of the system of ODE from equations (1.3) and (1.4) using an equal soldier accuracy of 0.05

We can see that for any initial conditions other than equal troop numbers, the side with the least troops quickly tends to zero and the dominant side loses comparatively few troops which we have previously discussed.

## Guerrilla Warfare and Unaimed Fire

The linear law can be extended to apply to two specific cases, guerrilla combat and unaimed fire into an enemy occupied area. In guerrilla combat, the army is designed to be small and stealthy, therefore the larger the army the more likely they are to be found and attacked, but also the more likely they are to kill the opposing army. The rate of attrition for each army is dependant on the size of both armies. For unaimed fire, the rate of attrition depends on not only the amount of attacking soldiers firing but also the amount of enemy soldiers in a given area, so is also suitable for this model.

This can be described by the equations:

, (1.7)

. (1.8)

Again we can plot a phase portrait indicating the outcome for different initial troop starting values.

Figure 1. Phase portrait of the system of ODE from equations (1.7) and (1.8) using an equal soldier accuracy of 0.05

This phase portrait doesn't show us very much more than we already know. To cause as much damage to the enemy before the battle is over it is very important to have your army as effective as possible, because mathematically it is the only variable that distinguishes your army from the opposing army.

## Verification of Lanchester's Square Law

For this verification we will use the Battle of Iwo Jima and the data from Capt. Morehouse. J.H. Engel produced a paper verifying the model for Iwo Jima using an analytical approach; here I shall use a numerical approach. The battle took place on the island of Iwo Jima and was an engagement of US and Japanese forces. It is ideally suited since Japanese forces were neither reinforced nor withdrawn and combat ended when Japanese forces were eliminated on the 36th day. During the first few days differing numbers of US troops were deployed which leads us to modify our equation (1.3) to allow for reinforcements.

(1.9)

(1.10)

Where:

b, r is the strength of the US, Japanese army, represented by blue and red respectively,

v, u is the average accuracy (or efficiency) of the US, Japanese army, represented by blue and red respectively,

t is the time in days,

B(t) is the reinforcements for the US troops at time t, represented by blue.

The numbers of units deployed were as follows:

Using the data from Captain Morehouse, we can plot a graph of the recorded active U.S. troop numbers. (appendix 1.G and 1.F)

Now we can use our data to see if our model fits the battle. To do this we must first calculate the accuracy of both armies. First start with equation (1.10) because it is the simpler of the two.

## ,

## ,

## ,

The integral on the right hand side is being integrated with respect to time not b, so the trapezium rule can be used as an approximation.

## ,

## ,

## ,

## .

Now that we have we can start to solve for . It should be noted Engel states,

"The island was declared secure on the 28th day, although fighting kept up until the 36th day."

This is important because for our model we are expecting two armies to meet. From the 28th to the 36th day fighting was more likely to be sparse because it resembled more of a 'clean-up' operation than that of a battle.

## ,

## ,

## ,

## ,

## .

## ,

(1.11)

Here it is a little more difficult to estimate, because previously we used the trapezium rule and now we do not know the data for the daily active troops in the Japanese army, because all of the information was likely destroyed. We can use (1.10) and our value for to establish an estimate from to .

## ,

## ,

## ,

## .

At time ,

## .

(1.12)

We can approximate the integral,

## ,

Using (1.12) for each of r(x), calculating the value in Matlab gives,

## .

This value can be substituted back into (1.11) to give the approximation for .

## ,

## ,

## .

We can now use Matlab to form a plot of our new model and see how accurate it has been. With a little modification appendix 1.A can be modified to give appendix 1.H, to allow for reinforcements at various points.

Figure 1. Modelled troop numbers in comparison to data from Capt. Morehouse

As we can see the model fits the data reasonably well. It should be noted again that Engel used an analytical approach rather than a numerical one, and calculated different values of and . Using Engel's values of and we see some very interesting results.

Figure 1. Modelled troop numbers when using Engel's calculations for u and v.

The model fits the data almost perfectly, which shows that the small rounding errors in the numerical approach cause a large effect as time increases. Using the more accurate calculations we can experiment with different sets of data, changing variables to see how the battle may have occurred. What if the third US reinforcement never arrived? How would the battle differ if Japanese forces were reinforced to match the US arrivals?

Figure 1. Theoretical outcome if the second US reinforcement never landed.

Figure 1. Theoretical outcome if the Japanese troops were reinforced to match each US troop deployment.

## 3:1 Ratio

An idea that has been traditionally accepted is the rule that defending forces should be able to easily match the firepower of 3 attacking soldiers for each defending soldier. This has been discussed thoroughly and relies upon good terrain conditions for either party. In our verification the US troops did outnumber the Japanese 3 to 1, after reinforcements, but from the model it can be shown that they would have still won without the extra troops albeit with much more considerable losses.

## Conclusions

The Lanchester laws give us various insights into battle conditions. As we have seen, the N-Square law can be used to model the outcome of certain battles, and lead us to ask certain 'what if?' questions. The main problem is that it is usually impossible to determine accuracy or efficiency of each army before the battle, and it is unclear about the effect of environmental factors, such as morale and terrain advantage. This doesn't mean that the models are completely useless, they provide us with a means to analyse our previous battles to develop strategies for the next battle. If a similar battle was fought to Iwo Jima then we could model the outcome to minimise friendly losses. Lanchester's laws also provide us with the idea of dividing the enemy forces. It should be a given that dividing the enemy forces and attacking each 'sub-army' one at a time would give us an advantage, but we can show that to minimise the losses occurred, we have to maximise the difference in army size, thus maximising the difference of the squares (equation 1.6a). We can also see that the number of troops an army brings to the battle has a much larger effect than the accuracy of efficiency of each soldier. For example, for the blue to match an increase in the red army of times, the blue army would have to change their efficiency to the current value. Lanchester Laws do have their limitations, but provided us some useful tools for modeling combat, and laid the groundwork for modern combat tactics.

## Stochastic Methods

After Lanchester put forward his power laws, criticism arose as to the validity of the models that they produced. The original power laws are deterministic; the next actions on the battlefield are a direct result of the previous results. Some scholars chose to continue to verify Lanchester's models and analyze them to better fit realistic scenarios. Others have argued that battles involve randomness that cannot be measured but can be so are not deterministic but stochastic and need to be modeled with probabilities.

One of these methods is to use Markov properties and to assume the battle goes through a series of different states.

Let:

be the initial number of blue, red troops respectively.

be the number of survivors of blue, red troops respectively.

be the number of casualties of blue, red troops respectively.

be the average efficiency of a blue, red soldier respectively.

be the time.

be the state of the battle where blues, reds have or r survivors respectively.

To model combat as a Markov chain we have to make some assumptions:

The force levels are integer values.

The time is measured in times steps where at most one casualty occurs, alternatively this can be interpreted as measuring the time step in number of kills.

There are no absorbing states except when or .

The maximum number of kills is , since fighting stops completely when either there is only one combatant left or there are no combatants left in one army of the battle. These are considered our absorbing states. For each non-absorbing state, the transition may take one of two paths, indicating a blue loss or indicating a red loss.

Let the transition matrix Q be denoted as where the transition probabilities are given by:

, (2.1)

. (2.2)

It can be shown that the state probabilities can be defined as:

. (2.3)

Let the initial condition . (2.4)

If battles are fought to destruction of one side, which is in our case, it has been shown by Brown that for battles fought using square law conditions the probability of red winning is:

. (2.5)

Where:

, (2.6)

## .

The 3:1 rule has been used as a rule of thumb for attacking a defensive force. It states that to win, the attacker must outnumber the defender 3:1.

Kress and Talmor undertook some investigation into the applicability of the model to various combat situations. We shall consider the square law.

Their model assumes that the red force attacking is 3 times larger than the blue defending force, but also that the forces are equally match, that is that the ratio of the squares of the initial army size of red to blue is equal to the ratio of the efficiency of blue to red (equation 2.6).

Therefore for an initial army size of the value of .

A table of results can be found for different initial army sizes for blue.

9.5

0.42

0.41

0.39

0.38

0.37

9.25

0.44

0.44

0.44

0.43

0.43

9

0.47

0.48

0.48

0.48

0.49

8.5

0.52

0.56

0.58

0.59

0.61

8

0.58

0.64

0.67

0.70

0.72

Table 2.1 Probability of red winning for different initial troop numbers

From this table it can be deduced that for a red army attacking a fortified blue army the probability of red winning converges upward to a value of 0.5, as the battle gets larger. This agrees with the theory that the forces should be evenly matched.

K. R. McNaught also investigated the idea of the 3:1 rule, but did so in a slightly different way. McNaught experimented with splitting up the armies into a lot of parallel armies fighting sub battles, then the survivors fighting another set of parallel battles and so on until annihilation of one side. This was to see how the effect of splitting the battle to start with would affect the chances of winning. His model makes the assumption that soldiers from each sub-army play no part in any other sub-battle until the next state is activated.

His method was to split up the initial armies into n number of nodes, as evenly as possible.

Then each node fights the first round of battles, each battle in the first round is fought to annihilation. The armies then reorganize so that the survivors from each side do battle in one final node, there has to be only one node in the final battle to ensure that there is total attrition of one army. The 3:1 ratio is used again, where a red attacker is attacking with 3 times the army size of the blue defender. A number of scenarios were calculated, changing the variables of initial troop size and initial number of nodes () in the first round.

P[B]

0.629

0.616

0.603

0.593

0.585

0.579

0.574

0.570

Table 2.2 Probability of blues winning for different initial force sizes for n=2.

Appendix (2.A) shows the tables for different values of .

It can be seen that the higher the value of , the more likely it is that the blues are going to win. This result agrees with our initial finding that splitting the battle is advantageous to the army with the fewer troops, but it also shows that for equally matched troops, one side is more likely to win.

## Concluding Remarks

After investigating to show how the n-square rule gives different results for deterministic and stochastic models it can be said that that the stochastic variant shows that there isn't equality and one of the sides has a greater chance of winning. We considered the situation that of supposed equality in Lanchester's deterministic laws. The forces should be of equal match but these papers show that the side with the higher efficiency actually was a better chance of winning. It should also be mentioned that as the size of the battle get bigger the probabilities tend towards 0.5, indicating equal chance of winning which would be interpreted as a draw for the deterministic laws.

A comparison of the results also agrees that our initial findings are correct, that it is more advantageous to try to split the enemy into smaller sub-armies, but interestingly, the approach used here also splits the defending army into the same number of sub armies.

## Application of Lanchester's Laws to Animals

In chapter 1 we introduced Lanchester's Power laws, and in this chapter we shall be looking at the application of these laws to animals.

## Application toÂ combat strategies of ants

In chapter 1 we established that the square law dealt with aimed fire from an army and the linear law dealt with lines of soldiers meeting on a battlefield. Ants are much less regimented when it comes to defending their territory, and often don't have ranged attacks although some ants have the ability to spray chemical compounds to neutralise their opponents. Ants mainly fight melee battles where all of the attackers to be able to engage the enemy, a free flowing battle where both sides are mixed in together.Â We can interpret the laws when applying them to ants as follows. The square law would describe small ants entering a battle with the plan of outnumbering their opponent where the death rate is proportional to the number of opponents. The linear law would describe large ants entering a battle with lower numbers but size and strength therefore efficiency on their side where the death is proportional to the number of both sides.

There have been various papers in biological journals experimenting with different conditions and different species of ants. Some of these have suggested that the Square Law should model the combat.

McGlynn conducted field experiments to monitor dominance in different foraging situations. He set up various test sites with petri dishes filled with bait. The petri dishes were then given entrance points of different sized holes. Some were given a small hole only big enough to fit a couple of ants at a time; others were cut away so that one half of the base of the dish was opened up as an entrance.

It was shown that when the dish had a large hole, so that there was little restriction on the amount of ants that could reach the bait, the smaller species of ants dominated the petri dish. When the ants were restricted by making the access holes smaller, the dominance was by the larger species of ants.

Interestingly there was little dominance from the medium sized ants, this is unclear why but perhaps they lacked both the strength and the numbers to cause enough of an impact.

Their findings suggest that when there are no restrictions on the amount of ants able to engage in combat, that the smaller ants with the higher numbers win which supports the application of the square law to ants.

Whitehouse and Jaffe took a slightly different approach and monitored some ant territory before also forcing some artificial battles. They found that when dealing with battles between ant colonies the colony that won the battle was often won by the colony that recruited numerous small worker ants and losses were proportional to the numbers of the opposite side for each colony of ant. In small battles the larger soldier ants were sent into combat, indicating the linear law, but as the battles increased in size lots of smaller ants were recruited and losses followed the square law. This indicates that in those situations lots of small or poorly armed ants were better at defending the territory than fewer larger ants.

These papers claim that the Lanchester square law models the combat of ants well, though McGlynn does accept that other factors may play a role in the results, such as "territoriality and aggressiveness of the species", nest locations and "needs of the colony".

The third paper in this discussion is one from Plowes and Adams. Again, they used experimental data, but used Bayesian inference to calculate the results from the generalised Lanchester model.

The generalised Lanchester model is:

, (3.1)

. (3.2)

Where:

is a measure of how dependant the soldier efficiency is on the number of blues or reds respectively.

is the measure of how dependant the group ability is on the number of blues or reds respectively.

Therefore for Lanchester's linear law and ,

## ,

## .

For Lanchester's square law and ,

## ,

## .

can be calculated from battle data using Bayesian probability theory, and for these cases we shall only consider. Values of can be interpreted as each sides kill rate is proportional to the kill rate of the opponent, until where the efficiency of each side is totally dependant on the efficiency of the other side.

The experiments consisted of collecting different sized ants, from different colonies, and putting them into a battle arena to see who would win.

The variables that they changed were the size of the ants, the initial group sizes of each side, and the colony the ants came from.

Their results are as follows

Table 3.1 Results from Plowes and Adams: Initial group size, mean final size and % mortality after 24 h of fighting. N is the number of repeated experiments for each test.

They calculated the values of and for each battle, where is the relative fighting strengths of the two armies modelled by a modification of that equation in chapter 1 to allow for and .

(3.3)

Their results are as follows

Table 3.2 Results from Plowes and Adams: Estimated values of and of R (with 95% credibility intervals) for each test.

They found that the average value of was 1.04, which is far from the value of needed for the square law. Though there is quite a large range in the value of none of the values even come close to the square law. This is not really surprising, since the combat of quite closely resembles that of ancient human combat, which too follows the linear law.

## Application to the combat of chimpanzees

There has also been much discussion about the application of the laws to territorial defence of chimpanzees, and also to lion prides. A paper by Wilson, Britton and Franks discusses experiments involving simulating chimpanzee calls. These were performed to monitor the response of local populations of chimpanzees to territorial intruders.

Starting with Lanchester square law:

(1.3)

(1.4)

If we eliminate time, and integrate we can give the state equation for the square law.

(1.6b)

If the battle is fought to destruction of one side then

They found that for males to approach, the number of males had to outnumber the number of simulated calls of intruding chimpanzees by a factor of 1.5.

This was shown to be true since the chimpanzees didn't approach when they were on their own and when joined by 1 or more allies they approached. It was also shown that when they chimpanzees had more numbers, they approached at a faster rate.

## Concluding Remarks

There isn't a lot of evidence to suggest that Lanchester's Laws are applicable here. Since the papers researched are biology papers and the experiments were carried out accordingly some of them don't really show a lot mathematically. This is not to say they are not useful for their purpose, but they don't explicitly back up the application of Lanchester and their conclusions were often interpreted to suit the hypothesis. Plowes and Adams had the most mathematically complex paper, which showed that if any law were to model the combat of ants it would be the linear law. Given more research there may be a better chance of experimenting further.

## Conclusion

In summary, Lanchester's laws were good, but have their limitations. The simple combat models involved allow us to match the estimated data to that of known battles, but don't take into account spatial or temporal effects, so are quite limited in their application. The basic laws only allow us to model certain battles, so a better approach is needed. Stochastic methods allow us to measure our probability of winning, but they still require prior knowledge about the battles that we're about to fight, so extensive modelling can only be done after the battle. They can give us some idea about the probability of winning, but require certain assumptions that don't usually apply to real battles. It was discussed how relevant the power laws were application to social animals. The animals tested were various species of ant and chimpanzee. There doesn't seem to be enough evidence to support the application of the square law, and all of the findings point towards the linear law, if any applicability is to be used. It seems that the laws are useful in explaining why some things might happen, but not enough extensive research has gone into the topic to provide large amounts of evidence. It should be noted that there are countless unknown variables affecting the outcomes of battles, there are too many options and factors that can occur. In the end, combat modelling sometimes proves to be inadequate because it not truly predictive. We can analyse data to explain what has happened and why, but when it comes to predicting the outcome we fall short. The most we can hope to achieve is a stochastic model, to say how likely something is to happen, and even then the chaos involved in real life systems makes these inaccurate. Ultimately they are a good tool for helping us to have an idea about what is going on and have provided us with some useful information to make rational decisions about the battles we are fighting.

## Appendix

## Chapter 1

Appendix 1.A - Matlab code for the m-file lan_square.m

function lan_square

% m-file used to model the number of soldiers when

% two armies meet over a time period using Lanchester's square law.

% by Richard Dunne

% Uses the function ode_square.m

## % ----------------------------------------------------------------------

clc

clear

% Initial conditions are predefined

blue=10000; % initial blue soldiers

red=5000; % initial red soldiers

v=0.05; % accuracy of blue soldiers

u=0.05; % accuracy of red soldiers

time_end=100;

t = 0:0.001:time_end;

y0 = [blue red];

acc = [v u];

options = odeset('AbsTol',1e-6,'RelTol',1e-6);

[T,Y] = ode45(@ode_square,t,y0,options,acc);

[m,n]=size(Y);

for i=1:m % controlling the point at which one side is all dead

if Y(i,1)<0 % if blue troop number is below zero

Y(i,1)=0; % set troop number to zero

Y(i,2)=Y(i-1,2); % set red troop number to previous number

elseif Y(i,2)<0 % if red troop number is below zero

Y(i,2)=0; % set troop number to zero

Y(i,1)=Y(i-1,1); % set red troop number to previous number

end

end

for k=1:m % controlling the point at which to plot the graph axis

if Y(k,1)<=0 % if blue troop number is below zero

break

elseif Y(k,2)<=0 % if red troop number is below zero

break

end

end

% plotting a graph

plot(T,Y(:,1),'b-',T,Y(:,2),'r-');

ymax=max(blue,red);

axis([0 T(k,1)*1.1 0 ymax*1.1])

xlabel('Time')

ylabel('Troops')

legend('Blue troops','Red troops')

function dy = ode_square(t,y,acc)

% function to be integrated

dy = zeros(2,1);

dy(1) = - acc(2) * y(2);

dy(2) = - acc(1) * y(1);

end

% end of file

end

Appendix 1.B - Matlab code for m-file lan_square_split.

function lan_square_split

% model the number of soldiers when two armies meet over a time

% period using Lanchester's Square Law and a splitting of the second army.

% by Richard Dunne

% uses the function ode_square.m

## % ----------------------------------------------------------------------

clc

clear

split=2; % number of seperate squads the red army is split into

ini_blue=10000; % initial blue soldiers

ini_red=10000; % initial red soldiers

v=0.05; % accuracy of blue soldiers

u=0.05; % accuracy of red soldiers

time_end=100;

num_blue=ini_blue;

num_red=ini_red/split;

for run=1:split

t = 0:0.001:time_end;

y0 = [num_blue num_red];

acc = [v u];

options = odeset('AbsTol',1e-6,'RelTol',1e-6);

[T,Y] = ode45(@ode_square,t,y0,options,acc);

[m,n]=size(Y);

for i=1:m % controlling the point at which one side is all dead

if Y(i,1)<0 % if blue troop number is below zero

Y(i,1)=0; % set troop number to zero

Y(i,2)=Y(i-1,2); % set red troop number to previous number

elseif Y(i,2)<0 % if red troop number is below zero

Y(i,2)=0; % set troop number to zero

Y(i,1)=Y(i-1,1); % set red troop number to previous number

end

end

for k=1:m % controlling the point at which to plot the graph axis

if Y(k,1)<=0 % if blue troop number is below zero

break

elseif Y(k,2)<=0 % if red troop number is below zero

break

end

end

% plotting a graph

subplot(1,split,run)

plot(T,Y(:,1),'b-',T,Y(:,2),'r-');

ymax=max(ini_blue,ini_red);

axis([0 T(k,1)*1.1 0 ymax*1.1])

xlabel('Time')

ylabel('Troops')

legend('Blue troops','Red troops')

num_blue=min(Y(:,1));

num_red=ini_red/split;

end

function dy = ode_square(t,y,acc)

% function to be integrated

dy = zeros(2,1);

dy(1) = - acc(2) * y(2);

dy(2) = - acc(1) * y(1);

end

% end of file

End

Appendix 1.C - Matlab code for phase_square.m

% m-file to plot phase portrait showing outcome of two armies meeting under

% n-square conditions

% by Richard Dunne

% This script file uses the m-file vectorfield.m by Steve Lynch

## % ----------------------------------------------------------------------

clear

clf

clc

hold on

sys=inline('[-0.05*x(2);-0.05*x(1)]','t', 'x');

vectorfield(sys,0:250:10000,0:250:10000);

for i=0:500:10000

[t,xs] = ode45(sys,[0 100],[i 10000]);

plot(xs(:,1),xs(:,2))

end

for j=0:500:10000

[t,xs] = ode45(sys,[0 100],[10000 j]);

plot(xs(:,1),xs(:,2))

end

hold off

xlabel('Blue troops')

ylabel('Red troops')

Appendix 1.D - Matlab code for phase_unaimed.m

% m-file to plot phase portrait showing outcome of two armies meeting under

% guerrilla warfare or unaimed fire conditions

% by Richard Dunne

% This script file uses the m-file vectorfield.m by Steve Lynch

## % ----------------------------------------------------------------------

clear

clf

clc

hold on

sys=inline('[-0.05*x(2)*x(1);-0.05*x(1)*x(2)]','t', 'x');

vectorfield(sys,0:250:10000,0:250:10000);

for i=0:1000:10000

[t,xs] = ode45(sys,[0 100],[i 10000]);

plot(xs(:,1),xs(:,2))

end

for j=0:1000:10000

[t,xs] = ode45(sys,[0 100],[10000 j]);

plot(xs(:,1),xs(:,2))

end

hold off

xlabel('Blue troops')

ylabel('Red troops')

Appendix 1.E - Matlab code for vectorfield.m

% Copyright Birkhauser 2004. Stephen Lynch.

function vectorfield(deqns,xval,yval,t)

if nargin==3;

t=0;

end

m=length(xval);

n=length(yval);

x1=zeros(n,m);

y1=zeros(n,m);

for a=1:m

for b=1:n

pts = feval(deqns,t,[xval(a);yval(b)]);

x1(b,a) = pts(1);

y1(b,a) = pts(2);

end

end

arrow=sqrt(x1.^2+y1.^2);

quiver(xval,yval,x1./arrow,y1./arrow,.5,'r');

axis tight;

Appendix 1.F - Data from Capt Morehouse on active US troop numbers throughout the Battle of Iwo Jima

Day #

Active U.S. Troops

1

52839

2

50945

3 and 4

56031

5

53749

6

66155

7

65250

8

64378

9

62874

10

62339

11

61405

12

60667

13

59549

14

59345

15

59081

16

58779

17

58196

18

57259

19

56641

20

54792

21

55308

22

54796

23

54038

24

53938

25

53347

26

53072

27

52804

28

52735

29

52608

30

52507

31

52462

32

52304

33

52155

34

52155

35

52155

36

52140

Appendix 1.G - Graph of active U.S. troops during the Battle of Iwo Jima

Appendix 1.H - Matlab code for iwojima_veri.m

function iwojima_veri

% code to model the outcome of Iwo Jima using Morehouse's data and

% Lanchester's equations with US reinforcements

clf

clc

clear

%data from Capt Morehouse

US=[0;52839;50945;56031;56031;53749;66155;65250;64378;62874;62339;61405;...

60667;59549;59345;59081;58779;58196;57259;56641;54792;55308;54796;...

54038;53938;53347;53072;52804;52735;52608;52507;52462;52304;52155;...

52155;52155;52140];

day=transpose(0:1:36);

% Initial conditions are predefined

blue=00; % initial US soldiers

red=21500; % initial Japanese soldiers

v=0.0108; % accuracy of US soldiers

u=0.0614; % accuracy of Japanese soldiers

t_end=40;

t = 0:1:t_end;

y0 = [blue red];

acc = [v u];

options = odeset('AbsTol',1e-6,'RelTol',1e-6);

[T,Y] = ode45(@ode_iwojima,t,y0,options,acc);

[m,n]=size(Y);

for i=1:m % controlling the point at which one side is all dead

if Y(i,1)<0 % if blue troop number is below zero

Y(i,1)=0; % set troop number to zero

Y(i,2)=Y(i-1,2); % set red troop number to previous number

elseif Y(i,2)<0 % if red troop number is below zero

Y(i,2)=0; % set troop number to zero

Y(i,1)=Y(i-1,1); % set red troop number to previous number

end

end

% plotting a graph

plot(T,Y(:,1),'b-',T,Y(:,2),'r-',day,US,'b+');

xlabel('Time (Days)')

ylabel('Troops')

legend('US troops','Japanese troops','US troop data from Morehouse')

set(gca,'XTick',0:2:40)

## % -------------

function dy = ode_iwojima(t,y,acc)

% function to be integrated

dy = zeros(2,1);

dy(1) = B(t) - acc(2) * y(2);

dy(2) = - acc(1) * y(1);

end

## % -------------

function USre = B(T) % subfunction for adding US reinforcements

for j = 1:length(T)

t = T(j);

if (t>=0 && t<1)

USre(j) = 54000;

elseif (t>=2 && t<3)

USre(j) = 6000;

elseif (t>=5 && t<6)

USre(j)=13000;

else

USre(j) = 0;

end

end

end

end

Appendix 1.I - Matlab code for iwo_veri_v2.m

function iwojima_veri_v2

% code to model the outcome of Iwo Jima using Morehouse's data and

% Lanchester's equations with US and Japanese reinforcements

clf

clc

clear

% Initial conditions are predefined

blue=00; % initial US soldiers

red=21500; % initial Japanese soldiers

v=0.0106; % accuracy of US soldiers

u=0.0544; % accuracy of Japanese soldiers

t_end=60;

t = 0:1:t_end;

y0 = [blue red];

acc = [v u];

options = odeset('AbsTol',1e-6,'RelTol',1e-6);

[T,Y] = ode45(@ode_iwojima,t,y0,options,acc);

[m,n]=size(Y);

for i=1:m % controlling the point at which one side is all dead

if Y(i,1)<0 % if blue troop number is below zero

Y(i,1)=0; % set troop number to zero

Y(i,2)=Y(i-1,2); % set red troop number to previous number

elseif Y(i,2)<0 % if red troop number is below zero

Y(i,2)=0; % set troop number to zero

Y(i,1)=Y(i-1,1); % set red troop number to previous number

end

end

% plotting a graph

plot(T,Y(:,1),'b-',T,Y(:,2),'r-');

xlabel('Time (Days)')

ylabel('Troops')

legend('US troops','Japanese troops')

set(gca,'XTick',0:t_end/10:t_end)

## % -------------

function dy = ode_iwojima(t,y,acc)

% function to be integrated

dy = zeros(2,1);

dy(1) = B(t) - acc(2) * y(2);

dy(2) = R(t) - acc(1) * y(1);

end

## % -------------

function USre = B(T) % subfunction for adding US reinforcements

for j = 1:length(T)

t = T(j);

if (t>=0 && t<1)

USre(j) = 54000;

elseif (t>=2 && t<3)

USre(j) = 6000;

elseif (t>=5 && t<6)

USre(j)=13000;

else

USre(j) = 0;

end

end

end

## % -------------

function JapRe = R(T) % subfunction for adding Japanese reinforcements

for j = 1:length(T)

t = T(j);

if (t>=3 && t<4)

JapRe(j) = 6000;

elseif (t>=6 && t<7)

JapRe(j) = 13000;

else

JapRe(j) = 0;

end

end

end

## % -------------

end

## Chapter 2

Appendix (2.A) - Tables to show the probability of blue winning for different initial army sizes and different values of

P[B]

0.647

0.628

0.611

0.599

0.590

0.583

0.577

0.573

P[B]

0.668

0.647

0.629

0.616

0.606

0.599

0.592

0.587

P[B]

0.682

0.660

0.640

0.626

0.615

0.606

0.600

0.594