The n-square law in warfare
Modified from Lanchester's article

The differential equations are db/dt = -r and dr/dt = -b.

The solutions to the system is easily determined as the equations are `separable', namely we find d^2 b / dt^2 = b and d^2 r / dr^2 = r.

Following Lancaster, we call the forces blue and red (and not English and French, or ...). We normalize so that there is initially one red unit, and there are more blue units than red units.

(* the lines below solve the equations and output the critical time where the red force is annihilated. *)
DSolve[{b'[t] == - r[t], r'[t] == - b[t], b[0] == B, r[0] == R}, {b, r}, t]

Solve[-B+B (E^(2 t))-R-(E^(2 t)) R == 0, t]

(* tcritical is where red is annihilated *)
tcritical[B_,R_] := Log[((Sqrt[B+R])/(Sqrt[B-R]))];
(* adjusted time sets any time greater than the critical time equal to the critical time -- helps in plotting *)
adjustedtime[B_,R_,t_] := If[t ≤ tcritical[B,R], t, tcritical[B,R]];
(* btemp is how b evolves as long as there are units of r left. It is absurd to continue using this model after r is annhiliated, as it would lead to negative red units creating blue units which create more negative blue units which.... *)
btemp[B_,R_,t_] := (1/2) (E^(-t)) (B+B (E^(2 t))+R-(E^(2 t)) R);
b[B_,R_,t_] := btemp[B,R,adjustedtime[B,R,t]];
rtemp[B_,R_,t_] :=-(1/2) (E^(-t)) (-B+B (E^(2 t))-R-(E^(2 t)) R);
r[B_,R_,t_] := rtemp[B,R,adjustedtime[B,R,t]];
Print["The plot below shows how many blue and red forces are alive at any given moment."];
Print["The blue function is (1/2) (B+R) (E^(-t)) + (1/2) (B-R) (E^t)." ];
Print["The red function is (1/2) (B+R) (E^(-t)) - (1/2) (B-R) (E^t)." ];
Manipulate[Plot[{r[B,R,t], b[B,R,t],0,2}, {t,0,1.02 tcritical[B,R]+.001}], {B,1.0001 R,2R},{R,1,10}]
Print["The plot below shows the initial and final concentration of blue forces."]
Manipulate[Plot[{b[B,R,0],b[B,R,tcritical[B,R]]},{t,0,1}, PlotRange -> {0,2}], {B,1.0001 , 2}, {R,1,2}]
Print["Below is a plot of how many blue survive versus  how many blue went to battle against a red force of 1 unit."];
Plot[{B,b[B,1,tcritical[B,1]]}, {B,1.01,4}]
Print["Below is a plot of how long it takes the blue force to wipe out the red force."];
Plot[tcritical[B,1],{B,1.001,5}]
Print["Below is a plot of how long it takes the blue force to wipe out the red force."];
Plot[tcritical[B,1],{B,1.01,Sqrt[2]}]

The equations imply that we have b^2 - r^2 = constant. Thus if a blue force of initial size B meets a superior blue force of size 1, the question is: how should blue divide his forces and red's forces to maximize what he ends with? Say blue goes into beta B and (1-beta)B to fight alpha R and (1-alpha) R. We assume beta B > alpha R. The amount of blue remaining after the first battle is Sqrt(beta^2 B^2 - alpha^2 R^2). This force then meets the red force of size Sqrt((1-alpha)^2 R^2 - (1-beta)^2 B^2).

firstbattle[B_,R_,alpha_,beta_] := Sqrt[(beta B)^2 - (alpha R)^2];
secondbattle[B_,R_,alpha_,beta_] := Sqrt[((1-alpha)R)^2 - ((1 - beta) B)^2];
thirdbattle[B_,R_,alpha_,beta_] := Sqrt[firstbattle[B,R,alpha,beta]-secondbattle[B,R,alpha,beta]];
Plot[thirdbattle[40,46,.5,beta], {beta,0,1}]

Solve[firstbattle[40,46,.5,beta] ==secondbattle[40,46,.5,beta], beta]
Plot[{firstbattle[40,46,.5,beta],secondbattle[40,46,.5,beta]},{beta,0,1}]

(* There is a problem with this analysis. It assumes that the red and blue forces are split in two, and no matter which battle ends first, the winning group waits till the other battle finishes before joining their comrades at arms! This is of course a really ridiculous assumption. So, a better model will be the two battles go simultaneously, and as soon as one finishes the survivors join the other battle. *)

(* We first have to find out how long the two battles last. We always start with a blue force of B, a red force of R, and the splits are beta B and (1-beta) B versus alpha R and (1-alpha) R. *)
(* From our analysis before, we know if a blue force of size B meets an R force of size R that the time elapsed until one is annihilated is one of
{t->Log[-((Sqrt[B+R])/(Sqrt[B-R]))]},{t->Log[((Sqrt[B+R])/(Sqrt[B-R]))]} *)
(* For simplicity we assume (1-beta) B < (1-alpha) R and beta B > alpha R *)
t1[B_,R_,alpha_,beta_]  := .5 Log[(beta B + alpha R) / (beta B - alpha R)];
t2[B_,R_,alpha_,beta_]  := .5 Log[((1-beta) B + (1-alpha) R) / ((1-alpha) R - (1-beta) B )];
t3[B_,R_,alpha_,beta_] := Min[t1[B,R,alpha,beta],t2[B,R,alpha,beta]]
Print["With Nelson's division, this is how long it takes his forces to win their first battle: ",t1[40,46,.5,.8], "; the amount of time it takes the sacrificial force of 8 to be annihilated is: ", t2[40,46,.5,.8]];
Plot[{t1[40,46,.5,beta],t2[40,46,.5,beta],t3[40,46,.5,beta]}, {beta,23.1/40,1}]

(* So, we can now figure out how long it takes Nelson's sacrifical fleet to be destroyed -- less time than it takes his larger force to destroy their opponents. We can now see how many red and blue would survive at each stage, and figure out what happens. *)
newB[B_,R_,alpha_,beta_] := btemp[beta B, alpha R, t3[B,R,alpha,beta]];
newR[B_,R_,alpha_,beta_] := rtemp[(1-beta) B, (1-alpha) R, t3[B,R,alpha,beta]] + rtemp[beta B, alpha R, t3[B,R,alpha,beta]];
Plot[{ newB[40,46,.5,beta],newR[40,46,.5,beta]},{beta,23.1/40,1}]
(* Plot[newR[40,46,.5,beta] - newB[40,46,.5,beta],{beta,23.1/40,1}] *)

Hyperlink["http://en.wikipedia.org/wiki/Battle_of_trafalgar"]