write(%io(2),'Modele proies-predateurs de Yamaguti ([Has])')
//
// affectation des parametres
//
lambda1=25;lambda2=-25;c1=1;c2=-1;
N=30;
//
dt=0.00004;Tmax=0.1;
dl1=dt*lambda1;dl2=dt*lambda2;
Longueur=1;dx=Longueur/(N-1);
cfl1=c1*dt/dx;cfl2=c2*dt/dx;
t=(1/(N-1)).*(0:(N-1));
//
u=[];v=[];A=[];B=[];
//
// matrice de convection pour u 
// 
for I=2:N,
  A(I,I)=1;A(I,I-1)=-1;
end
A(1,1)=1;A(1,N)=-1;
//
// matrice de convection pour v 
// 
for I=1:N-1;
  B(I,I)=-1;B(I,I+1)=1;
end
B(N,1)=1;B(N,N)=-1;
//
// conditions initiales
// 
for I=1:N
  u(I)=1.5+sin(2*%pi*(I-1)/(N-1));
  v(I)=4+2*cos(2*%pi*(I-1)/(N-1));
end
jmax=int(Tmax/dt);
//
// debut boucle principale
//
xbasc();
for j=1:jmax
  u0=u;
  u=u-cfl1.*A*u+dl1.*(u.*v);
  v=v-cfl2.*B*v+dl2.*(u0.*v); 
  ua=u(int(N/4));
  ub=u(int(3*N/4)); 
//
// trace toutes les 100 iterations
//
     if [int(j/100)==j/100]|[j==1] then 
       xsetech([0,0,0.5,0.5])
       xtitle('predateurs (repartition spatiale)','x','u(x)')
       plot2d(t',u,1,'011',' ',[0,0.5,1,8]);
       xsetech([0.5,0.,0.5,0.5])
       xtitle('proies (repartition spatiale)','x','v(x)')
       plot2d(t',v,1,'011',' ',[0,0,1,6.1]);
       xsetech([0.,0.5,0.5,0.5]) 
       xtitle('predateurs (evolution temporelle)','t','u(t,0.25)')
       plot2d(j*dt,ua,-1,'011',' ',[0,-1,0.1,8]); 
       xsetech([0.5,0.5,0.5,0.5]) 
       xtitle('portrait de phase','u','v')
       plot2d(u,v,1,'011',' ',[0.5,0,8,6]); 
      end
//
end
// fin boucle principale
//



