Example2.2 rev 6.mw
Example 2.2 Reversible Series Reactions (see equations (2.10))
Specify the equations.
| > |
eq[1]:=diff(Ca(t),t)=-k1*Ca(t)+k2*Cb(t); |
 |
(1) |
| > |
eq[2]:=diff(Cb(t),t)=k1*Ca(t)-k2*Cb(t)-k3*Cb(t)+k4*Cc(t); |
 |
(2) |
| > |
eq[3]:=diff(Cc(t),t)=k3*Cb(t)-k4*Cc(t); |
 |
(3) |
Specify the variables.
| > |
vars:=[Ca(t),Cb(t),Cc(t)]; |
![[Ca(t), Cb(t), Cc(t)]](images/Example2.2 rev 6_4.gif) |
(4) |
Specify the right hand side of the equations.
| > |
eqs:=[seq(rhs(eq[i]),i=1..3)]; |
 |
(5) |
Generate the coefficient matrix A.
| > |
A:=genmatrix(eqs,vars,A); |
 |
(6) |
Generate the exponential matrix of A.
Set the initial conditions vector:
| > |
Y0:=matrix(3,1,[1,0,0]); |
 |
(7) |
Obtain the solution.
Pull out the components of the solution.
The solution vector 'sol' and its elements (sol [1,1], e.g.) are too long to present here. They are functions of the rate constants (k1, k2, k3, and k4) and the independent variable t. One can obtain the solution from the CD with this book by changing the colons to semicolons at the end of the command line in the worksheet. As in Example 2.1, the solution obtained can be plotted for a particular set of values for the rate constants. Let’s set these to be the same as those used on page 282 of Constantinides and Mostoufi.[6]
| > |
pars:={k1=1.,k2=0.,k3=2.,k4=3.}; |
 |
(8) |
Obtain the concentrations as functions of time by substituting these values for the rate constants into the components of the solution vector:
 |
(9) |
 |
(10) |
 |
(11) |
Plot the results.
| > |
p[1]:=plot(Ca,t=0..10,thickness=4,linestyle=1,color=blue,labels=["t(min)","Concentration (mol/1)"],labeldirections=[horizontal, vertical],legend='C[A]'): |
| Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct |
|
| > |
p[2]:=plot(Cb,t=0..10,thickness=4,linestyle=1,labels=["t(min)","Concentrations(mol/1)"],labeldirections=[horizontal, vertical],legend='C[B]'): |
| > |
p[3]:=plot(Cc,t=0..10,thickness=4,linestyle=1,color=green,labels=["t(min)","Concentration (mol/1)"],labeldirections=[horizontal,vertical],legend='C[C]'): |
| > |
p[4]:=textplot([4,.9,k1=1.0*Unit(min^(-1))]),textplot([6,.9,k2=0]): |
| > |
p[5]:=textplot([4,.7,k3=2.0*Unit(min^(-1))]),textplot([7,.7,k4=3.0*Unit(min^(-1))]): |
| > |
display({seq(p[i],i=1..5)}, title="Figure Exp. 2.2.1 Concentrations of A, B, and C as functions of time.", axes=boxed); |
This figure matches Figure Exp. 5.2 on page 282 of Constantinides and Mostoufi, 1999.[6] For a different set of values for the parameters, the solution can be obtained by just substituting the numerical values of the rate constants into the solution vector components. We did not observe a maximum for Cb for this particular set of values of the rate constants. However, we can use different values of the rate constants to illustrate that a maximum can exist in the concentration of species B:
| > |
pars:={k1=10.,k2=0.5,k3=2.,k4=3.}; |
 |
(12) |
 |
(13) |
 |
(14) |
 |
(15) |
| > |
p[1]:=plot(Ca,t=0..5,thickness=4,color=blue,linestyle=1,labels=["t(min)","Concentration (mol/1)"],labeldirections=[horizontal, vertical],legend='C[A]'): |
| > |
p[2]:=plot(Cb,t=0..5,thickness=4,linestyle=1,labels=["t(min)","Concentration (mol/1)"],labeldirections=[horizontal, vertical],legend='C[B]'): |
| > |
p[3]:=plot(Cc,t=0..5,thickness=4,color=green,linestyle=1,labels=["t(min)","Concentration (mol/1)"],labeldirections=[horizontal, vertical],legend='C[C]'): |
| > |
p[4]:=textplot([2,.9,k1=10.0*Unit(min^(-1))]),textplot([3.5,.9,k2=0.5*Unit(min^(-1))]): |
| > |
p[5]:=textplot([2,.7,k3=2.0*Unit(min^(-1))]),textplot([3.5,.7,k4=3.0*Unit(min^(-1))]): |
| > |
display({seq(p[i],i=1..5)},title="Figure Exp. 2.2.2 Concentrations of A, B, and C as functions of time.",axes=boxed); |
We can find an equation in terms of the rate constants that will provide a means of finding the time at which the maximum in Cb occurs. We do this by using Maple's 'simplify' command and by finding ∂cb/∂t by using Maple's 'diff' command.
| > |
eq:=simplify(diff(cb,t)): |
Next, we use Maple's 'solve' command to set the equation (eq) equal to zero and solve for 'tmax':
The concentration of B at 'tmax' can be obtained by substitution of the 'tmax' expression into the solution for the concentration of B as a function of time.
| > |
cbmax:=simplify(subs(t=tmax,cb)): |
The solution 'cbmax' is not printed to conserve space. We can find if a maximum exists or not by substituting numerical values for the rate constants. If Cb has a maximum, 'tmax' should be real and positive. A value for 'tmax' can be obtained by substituting the same rate constants into the derived equations.
| > |
simplify(subs(k1=1.,k2=0.,k3=2.,k4=3.0,tmax)); |
 |
(17) |
| > |
simplify(subs(k1=2.,k2=0.,k3=2.,k4=3.0,tmax)); |
 |
(18) |
| > |
simplify(subs(k1=10.,k2=1.,k3=1.,k4=1.0,tmax)); |
 |
(19) |
An interesting case is when k1 = k3 and k2 = k4.
| > |
pars:={k1=2,k2=1/2,k3=2,k4=1/2}; |
 |
(20) |
| > |
A1:=evalm(subs(pars,evalm(A))); |
 |
(21) |
 |
(22) |
One of the eigenvalues is zero in this case.
| > |
Ca:=evalf(subs(pars,ca)); |
 |
(23) |
| > |
Cb:=evalf(subs(pars,cb)); |
 |
(24) |
| > |
Cc:=evalf(subs(pars,cc)); |
 |
(25) |
| > |
p[1]:=plot(Ca,t=0..5,thickness=4,color=blue,linestyle=1,labels=["t(min)","Concentration (mols/1)"],labeldirections=[horizontal, vertical],legend='C[A]'): |
| > |
p[2]:=plot(Cb,t=0..5,thickness=4,linestyle=1,labels=["t(min)","Concentration (mols/1)"],labeldirections=[horizontal, vertical],legend='C[B]'): |
| > |
p[3]:=plot(Cc,t=0..5,thickness=4,color=green,linestyle=1,labels=["t(min)","Concentration (mols/1)"],labeldirections=[horizontal, vertical],legend='C[C]'): |
| > |
p[4]:=textplot([1.5,.9,k1=1.0*Unit(min^(-1))]); |
![PLOT(TEXT([1.5, .9], k1 = `+`(`*`(1.0, `*`(Unit(`/`(1, `*`(min))))))))](images/Example2.2 rev 6_32.gif) |
(26) |
| > |
p[5]:=textplot([3.5,.9,k2=0.5*Unit(min^(-1))]); |
![PLOT(TEXT([3.5, .9], k2 = `+`(`*`(.5, `*`(Unit(`/`(1, `*`(min))))))))](images/Example2.2 rev 6_33.gif) |
(27) |
| > |
p[6]:=textplot([3.5,.6,k3=1.0*Unit(min^(-1))]); |
![PLOT(TEXT([3.5, .6], k3 = `+`(`*`(1.0, `*`(Unit(`/`(1, `*`(min))))))))](images/Example2.2 rev 6_34.gif) |
(28) |
| > |
p[7]:=textplot([3.5,.4,k4=0.5*Unit(min^(-1))]); |
![PLOT(TEXT([3.5, .4], k4 = `+`(`*`(.5, `*`(Unit(`/`(1, `*`(min))))))))](images/Example2.2 rev 6_35.gif) |
(29) |
| > |
display({seq(p[i],i=1..7)},title="Figure 2.2.3 Concentrations of A, B, and C as functions of time.",axes=boxed); |
Another interesting case is when k2= k4=0.
| > |
pars:={k1=1,k2=0,k3=1,k4=0}; |
 |
(30) |
| > |
A1:=evalm(subs(pars,evalm(A))); |
 |
(31) |
 |
(32) |
One of the eigenvalues is zero and the other two eigenvalues are repeated in this case.
| > |
Ca:=evalf(subs(pars,ca)); |
| Error, numeric exception: division by zero |
|
We get division by zero again as we did in Example 2.1. The solution can be obtained by using Maple's 'limit' command.
 |
(33) |
Alternatively, the four lines can be successively applied in the same statement as
| > |
Cb:=limit(limit(limit(limit(cb,k1=1),k2=0),k3=1),k4=0); |
 |
(34) |
| > |
Cc:=limit(limit(limit(limit(cc,k1=1),k2=0),k3=1),k4=0); |
 |
(35) |
| > |
p[1]:=plot(Ca,t=0..5,thickness=4,linestyle=1,color=blue,labels=["t(min)","Concentration (mols/1)"],labeldirections=[horizontal, vertical],legend='C[A]'): |
| > |
p[2]:=plot(Cb,t=0..5,thickness=4,linestyle=1,labels=["t(min)","Concentration (mols/1)"],labeldirections=[horizontal, vertical],legend='C[B]'): |
| > |
p[3]:=plot(Cc,t=0..5,thickness=4,color=green,linestyle=1,labels=["t(min)","Concentration (mols/1)"],labeldirections=[horizontal, vertical],legend='C[C]'): |
| > |
p[4]:=textplot([1.5,.9,k1=1.0*Unit(min^(-1))]); |
![PLOT(TEXT([1.5, .9], k1 = `+`(`*`(1.0, `*`(Unit(`/`(1, `*`(min))))))))](images/Example2.2 rev 6_43.gif) |
(36) |
| > |
p[5]:=textplot([1.5,.7,k2=0*Unit(min^(-1))]); |
![PLOT(TEXT([1.5, .7], k2 = 0))](images/Example2.2 rev 6_44.gif) |
(37) |
| > |
p[6]:=textplot([4,.6,k3=1.0*Unit(min^(-1))]); |
![PLOT(TEXT([4., .6], k3 = `+`(`*`(1.0, `*`(Unit(`/`(1, `*`(min))))))))](images/Example2.2 rev 6_45.gif) |
(38) |
| > |
p[7]:=textplot([4,.4,k4=0*Unit(min^(-1))]); |
![PLOT(TEXT([4., .4], k4 = 0))](images/Example2.2 rev 6_46.gif) |
(39) |
| > |
display({seq(p[i],i=1..7)},title="Figure 2.2.4 Concentrations of A, B, and C as functions of time.",axes=boxed); |
As can be seen by comparison, Figure Exp. 2.2.4 is the same as Figure Exp. 2.1.2 as expected.