Figure 2.12:

Leading-order inner U_0, outer u_0, and composite solutions u_{0c}, for Example \ref {ex:rxequil} with \epsilon =0.2, K=1, and k_{2}=1.

Code for Figure 2.12

Text of the GNU GPL.

main.m


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
%script to plot time evolution of reaction equilibrium example
hold on
K=1;
eps=2e-1;
t=0:0.01:2;
Uinn= exp(-(1+K)*t/eps) + 1/(1+K)*(1 - exp(-(1+K)*t/eps));
plot(t,Uinn,'--');
Vinn=1-Uinn;
% plot(t,Vinn);
Uout=1/(1+K)* exp(-K/(1+K)* t);
plot(t,Uout,':');
Ucomp=Uinn+Uout-Uout(1);
plot(t,Ucomp);
xlabel('t');
ylabel('u(t)');
axis([0 2 0 1]);
legend('Inner solution','Outer solution','Composite solution');

data = [t', Ucomp', Uinn', Uout'];
save  rxnequil.dat data