Example2.2.2 rev1.doc

advertisement
Example 2.2.2
Consider an nth order reaction
k
A 
 Pr oducts
governed by the ODE:
with the initial conditions c(0)=1; k is the rate constant , and n is the order of the reaction. Series
solutions are obtained in Maple below:
> restart:
> with(plots):
Enter the governing equation:
> eq:=diff(c(t),t)=-k*c(t)^n;
The analytical solution is found as:
> ca:=rhs(dsolve({eq,c(0)=1},c(t)));
Next, the series solution can be obtained as:
> sol:=dsolve({eq,c(0)=1},{c(t)},type=series);
By default, Maple returns series solutions accurate to the order of t6 . The order can be increased
as:
> Order:=8;
> sol:=dsolve({eq,c(0)=1},{c(t)},type=series);
Page 1
The order obtained is converted to polynomial form for plotting purposes.
> assign(sol):
> c(t):=convert(c(t),polynom);
Next, the series solution obtained is plotted for different values of parameters and compared with
the analytical solution.
> pars:={k=1,n=1};
> C:=subs(pars,c(t));
> Ca:=subs(pars,ca);
Error, numeric exception: division by zero
Since division by zero occurs, the limit is obtained.
> Ca:=limit(ca,n=1);
> Ca:=subs(k=1,Ca);
Page 2
> tf:=3;
> plot([C,Ca],t=0..tf,thickness=3,axes=boxed,title="Figure Exp.
2.2.3",labels=[t,"C"]);
We observe that the series solution diverges for values of t greater than 2. Next, plots are made
for different values of the parameters:
> pars:={k=1,n=1/3};
> C:=subs(pars,c(t));
> Ca:=subs(pars,ca);
> tf:=1.5;
Page 3
> plot([C,Ca],t=0..tf,thickness=3,axes=boxed,title="Figure Exp.
2.2.4",labels=[t,"C"]);
For these values, both the exact analytical solution and the series solution match exactly until
t=1.4. Next, a second order reaction is considered.
> pars:={k=1,n=2};
> C:=subs(pars,c(t));
> Ca:=subs(pars,ca);
> tf:=1;
> plot([C,Ca],t=0..tf,thickness=3,axes=boxed,title="Figure
2.2.5",labels=[t,"C"]);
Page 4
For this case, the series solution starts to diverge after t is greater than 0.4. Hence, one has to be
careful while using series solutions. The divergence of the series solution obtained depends
upon the problem and values of the parameters. Nevertheless, Maple can give series solutions to
the order t100 also.
>
Page 5
Download