(*This Notebook presents 4 things :  
              Competition Model*) 


  

Clear[k,  P,  ode1, ode2]

  
a = 
        0.5;
b =  .25;
c = 0.75;
	
  

	ode1 =  P'[t] == P[t] (1.  - P[t] - Q[t])
ode2 =  Q'[t]  == Q[t] (a - b Q[t] - c P[t])

(*NOTE :  
            This is the solver call for solving more than 1 ODE simultaneously*)

sol = 
      NDSolve[{ode1,  ode2,  P[0. ] == 1.25,  Q[0. ] == 1.25},  {P[t], 
          Q[t]},  {t, 0, 20}]

(* NOTE I PLOT THE SOLUTION NOW SINCE The previous statements just tells me it has finished solving*)

\(p1 = 
        Plot[Evaluate[{P[t]} /. sol], \ {t, 0, 
            20}, 
		PlotRange -> {0, 2}, \ 
          PlotStyle -> {RGBColor[1, 0, 
                0]}, 
		PlotLabel -> "P1 Population size"]\)


\(p2 = 
      Plot[Evaluate[{Q[t]} /. sol], \ {t, 0, 
          20}, 
		PlotRange -> {0, 2}, \ 
        PlotStyle -> {RGBColor[1, 0, 
              0]}, 
		PlotLabel -> "P2 Population size"]\)

(* This next command draws the phase plane for the 2 populations .  first, label the solution functions q1 and q2 .  Then, issue the call statement .  note, the steady state (as you can se from the plots above) is (0, 2) .  
                See how the trajectory goes there from the initial condition (1.25,  1.25) *)

q1 = P[t] /. sol[[1]]
q2 = Q[t] /. sol[[1]]

phaseplot1 = 
      ParametricPlot[{q1, q2}, {t, 0, 20}]