Example2.2.1.doc

advertisement
2.2 Nonlinear Ordinary Differential Equations
Example 2.2.1 Simultaneous Series Reactions
Consider a second order reaction
k1
k2
2A 
 B 
C
governed by the nonlinear ODEs:
=
=
with the initial conditions ca(0) = 1; cb(0) = 0 and cc(0) = 0; and, k1 and k2 are the rate
constants. The concentration of species C(cc) at any time is given by the material balance
ca + cb + cc = ca(0) = 1
The equation above is solved below in Maple:
> restart:
> with(plots):
The governing equations are entered here:
> eq[1]:=diff(ca(t),t)=-k1*ca(t)^2;
> eq[2]:=diff(cb(t),t)=k1*ca(t)^2-k2*cb(t);
The variables are entered here:
> vars:=(ca(t),cb(t));
The equations are stored in eqs.
> eqs:=(eq[1],eq[2]);
Page 1
The initial conditions are stored in ICs:
> ICs:=(ca(0)=1,cb(0)=0);
> sol:=dsolve({eqs,ICs},{vars});
> assign(sol):
> ca(t);
> cb(t);
The help command in Maple is invoked to describe Ei. The following description for Ei is given
in Maple's help file.
> ?Ei
Ei - The Exponential Integral
Page 2
Calling Sequence
Ei(z)
Ei(a, z)
Parameters
z - algebraic expression
a - algebraic expression
Description
• The exponential integrals, Ei(a, z), are defined for Re(z) > 0 by
> Ei(a, z) = convert(Ei(a, z), Int) assuming Re(z) > 0;
This classical definition is extended by analytic continuation to the entire complex plane using
> Ei(a, z) = z^(a-1)*GAMMA(1-a, z);
with the exception of the point 0 in the case of Ei(1, z).
• For all of these functions, 0 is a branch point and the negative real axis is the branch cut. The
values on the branch cut are assigned such that the functions are continuous in the direction of
increasing argument (equivalently, from above).
• The classical definition for the 1-argument exponential integral is a Cauchy Principal Value
integral, defined for real arguments x, as the following
> convert(Ei(x),Int) assuming x::real;
> value(%);
for x < 0, Ei(x) = -Ei(1, -x). This classical definition is extended to the entire complex plane
using
Ei(z) = -Ei(1, -z) + (ln(z) - ln(1/z))/2 - ln(-z)
Note that this extension has its branch cut on the negative real axis, but unlike for the 2-argument
Page 3
Ei functions this extension is not continuous onto the branch cut from either above or below.
That is, this extension provides an analytic continuation of Ei(z) from the positive real axis, but
not in any direction from the negative real axis. If you want a continuation from the negative real
axis, use -Ei(1, -z) in place of Ei(z).
Reference:
Abramowitz, M. and Stegun, I. Handbook of Mathematical Functions. New York: Dover
Publications Inc., 1965.
The concentration of species C is found using the material balance.
> cc(t):=1-ca(t)-cb(t);
Plots can be made for different values of rate constants.
> pars:={k1=1,k2=1};
> Ca:=subs(pars,ca(t));
> Cb:=subs(pars,cb(t));
> Cc:=subs(pars,cc(t));
Page 4
> p1:=plot(eval(Ca),t=0..10,thickness=3,color=green):
>
p2:=plot(eval(Re(Cb)),t=0..10,linestyle=1,thickness=3,axes=boxed
):
>
p3:=plot(eval(Re(Cc)),t=0..10,linestyle=2,thickness=3,color=mage
nta):
To get rid of the residual errors while calculating the Ei functions only the real part is plotted.
> display({p1,p2,p3},labels=[t,C],title="Figure Exp. 2.2.1");
> pars:={k1=2,k2=1};
> Ca:=subs(pars,ca(t));
> Cb:=subs(pars,cb(t));
Page 5
> Cc:=subs(pars,cc(t));
> p1:=plot(Ca,t=0..10,thickness=3,color=green):
> p2:=plot(Re(Cb),t=0..10,linestyle=1,thickness=3,axes=boxed):
>
p3:=plot(Re(Cc),t=0..10,linestyle=2,thickness=3,color=magenta):
> display({p1,p2,p3},labels=[t,C],title="Figure Exp. 2.2.2");
Page 6
We observe that a maximum exists for the concentration of species B. Sometimes, Maple gives
implicit solutions, i.e., independent variable (t), as a function of the dependent variable (y).
>
Page 7
Download