write(%io(2),'reaction de dissociation A+A<--> A+B et B-->...([LBL], page 474)');
a0=evstr(x_dialog('valeur initiale de A','1'));
b0=evstr(x_dialog('valeur initiale de B','0'));
k=evstr(x_dialog('taux de reaction directe','0.2'));
r=evstr(x_dialog('taux de reaction inverse','0.1'));
d=evstr(x_dialog('taux de dissociation','0.001'));
tpas=evstr(x_dialog('pas de temps de calcul','0.3'));
X0=[a0;b0];
getf('C:\Mes Documents\Agreg\oraux\equadiff\reac2.sci');
deff('a=aapprochee(t)','a=r*a0/(k+r)*exp(-d*k*t/(k+r))');
deff('b=bapprochee(t)','b=k*a0/(k+r)*exp(-d*k*t/(k+r))');
tfin=200;
t=0:tpas:tfin;
//
// solution ode
X=ode(X0,0,t,list(reac2,a0,b0,k,r,d));
//
// solution Euler
npas=int(tfin/tpas);XX=zeros(npas+1,2);XX(1,:)=X0';
for i=1:npas
   XX(i+1,:)=XX(i,:)+tpas.*reac2(tpas,XX(i,:),a0,b0,k,r,d)';
end
XXA=aapprochee(t);XXB=bapprochee(t);
xbasc()
leg='A solveur Scilab@B solveur Scilab@A Euler@B Euler@A approchee@B approchee';
plot2d([t',t',t',t',t',t'],[X(1,:)',X(2,:)',XX(:,1),XX(:,2),XXA',XXB'],[1,2,3,4,5,6],'121',leg);
xtitle('concentration des especes A et B','t')
//