:

## How to use Maple to solve a war-related math problem

Maple 15
 > restart;
 > with(DETools):
 > with(plots):
 > with(LinearAlgebra):
 > A:=<,>;
 (1)
 > alpha:=A-lambda*IdentityMatrix(2);
 (2)
 > Determinant(alpha);
 (3)
 > lambda1:=2;
 (4)
 > lambda2:=-2;
 (5)
 > beta:=>;
 (6)
 > ReducedRowEchelonForm(subs(lambda=lambda1,beta));
 (7)
 > V1:=;
 (8)
 > ReducedRowEchelonForm(subs(lambda=lambda2,beta));
 (9)
 > V2:=;
 (10)
 > A.V1-lambda1*V1;
 (11)
 > A.V2-lambda2*V2;
 (12)
 > sols:=c1*V1*exp(lambda1*t)+c2*V2*exp(lambda2*t);
 (13)
 > whattype(sols);
 (14)
 > convert(sols,Matrix);
 (15)
 > Dimensions(%);
 (16)
 > sols:=convert(sols,Matrix);
 (17)
 > sols[1,1];
 (18)
 > x:=t-> (18);
 (19)
 > sols[2,1];
 (20)
 > y:=t-> (20);
 (21)
 > solve({x(0)=300,y(0)=100},{c1,c2});
 (22)
 > assign(%);
 > R:=t-> x(t);
 (23)
 > G:=t-> y(t);
 (24)
 > R(0);
 (25)
 > G(0);
 (26)
 > diff(R(t),t)+4*G(t);
 (27)
 > diff(G(t),t)+R(t);
 (28)
 > display(plot([R(t),G(t)],t=0..1,color=[red,green],thickness=[3,3],gridlines=true,axis=[gridlines=[10,color=COLOR(RGB,0,0.7,0.7)]],font=["Copperplate",Bold,12],labels=["Time in Hours","No. of Soldiers"],labelfont=[Verdana,Bold,12]),plottools[line]([0.4,0],[0.4,225],linestyle=dash,color=COLOR(RGB,0,0,0.6),thickness=2));
 > fsolve(G(t)=0,t=0.4);
 (29)
 > R((29));
 (30)
 > display(dfieldplot([diff(r(t),t)=-4*g(t),diff(g(t),t)=-r(t)],[r(t),g(t)],t=0..0.4023594781,r=0..300,g=0..100,dirfield=[10,10],arrows=smalltwo,font=["Copperplate",Bold,12],labelfont=["Copperplate",Bold,12],color=COLOR(RGB,0.5,0.5,0.85),labels=["Red Army","Green Army"]),pointplot([[300,100]],symbol=solidcircle,color=black,symbolsize=17,gridlines=true,view=[0..300,0..100],axis[1]=[color=red],axis[2]=[color=green]));
 > data:=[seq([R(t),G(t)],t=0..0.42,.01)];
 (31)
 > plot1:=display(dfieldplot([diff(r(t),t)=-4*g(t),diff(g(t),t)=-r(t)],[r(t),g(t)],t=0..0.4023594781,r=0..300,g=0..100,dirfield=[10,10],arrows=smalltwo,font=["Copperplate",Bold,12],labelfont=["Copperplate",Bold,13],color=COLOR(RGB,0.5,0.5,0.85),labels=["Red Army","Green Army"],axesfont=["Copperplate",Bold,10]),pointplot([[300,100]],symbol=solidcircle,color=black,symbolsize=17,gridlines=true,view=[0..300,0..100],axis[1]=[color=red],axis[2]=[color=green]),plot(1/2*t,t=0..300,color=black,thickness=3)):
 > nops(data);
 (32)
 > animate(listplot,[data[1..round(k)],color=black,thickness=3,title="The Red Army Wins!!!",titlefont=["Verdana",Bold,14]],k=1..43,frames=43,background=plot1,paraminfo=false);

From the plot above it can be seen that the population of the Green Army is driven to extinction (i.e. becomes zero) first.  The army that's driven to extinction first is the losing army in the conflict.  The other army is thus victorious by default.

 >
 >
 >