Parameter Estimation for a Chemical Reaction - Maple Programming Help

Home : Support : Online Help : Applications and Example Worksheets : Science and Engineering : applications/ChemicalKineticsParameterEstimation

Parameter Estimation for a Chemical Reaction

Introduction

This application estimates the rate parameters for a reversible reaction with dimerization of an intermediate.

$\mathrm{C}+\mathrm{C}\underset{\mathrm{k__4}}{\overset{\mathrm{k__3}}{⇄}}\mathrm{D}$

It does this by doing the following:

 • Parameterizing (with respect to and $\mathrm{k__4}$) the numerical solution of the different equations that describe the reaction kinetics
 • Calculating the sum of the square of the errors between the model predictions and experimental data
 • Minimizing the sum of the square of the errors to find the best fit values of and $\mathrm{k__4}$

 > $\mathrm{restart}:\mathrm{with}\left(\mathrm{plots}\right):\mathrm{with}\left(\mathrm{Optimization}\right):$

Parameters and Experimental Data

 >

Concentrations of C and D over time

 > $\mathrm{times}≔\left[\begin{array}{ccccccccccc}0& 7& 14& 21& 28& 35& 42& 49& 56& 63& 70\end{array}\right]:$
 > $\mathrm{C_exp}≔\left[\begin{array}{ccccccccccc}0& 1.065& 1.383& 0.9793& 1.107& 0.7289& 0.7236& 0.4674& 0.6031& 0.6149& 0.3369\end{array}\right]:$
 > $\mathrm{D_exp}≔\left[\begin{array}{ccccccccccc}0& 0.0058& 0.2203& 0.4019& 0.3638& 0.456& 0.5014& 0.715& 0.4723& 0.7219& 0.7294\end{array}\right]:$

Reaction Kinetics

 >
 > $\mathrm{de2}≔\frac{ⅆ}{ⅆ\mathrm{t}}\mathrm{C__D}\left(\mathrm{t}\right)=\mathrm{k__3}\cdot \mathrm{C__C}{\left(\mathrm{t}\right)}^{2}-\mathrm{k__4}\cdot \mathrm{C__D}\left(\mathrm{t}\right):$
 > $\mathrm{ic}≔\mathrm{C__C}\left(0\right)=0,\mathrm{C__D}\left(0\right)=0:$

Sum of Square of Errors

 > $\mathrm{res}≔\mathrm{dsolve}\left(\left\{\mathrm{de1},\mathrm{de2},\mathrm{ic}\right\},\mathrm{parameters}=\left[\mathrm{k__1},\mathrm{k__2},\mathrm{k__3},\mathrm{k__4}\right],\mathrm{numeric}\right)$
 ${\mathrm{res}}{≔}{\mathbf{proc}}\left({\mathrm{x_rkf45}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (4.1)
 >
 > $\mathrm{sse}\left(0.01,0.002,0.02,0.002\right)$
 ${2.00578059621453}$ (4.2)

Minimize the Sum of the Square of the Errors

 >
 ${\mathrm{optPars}}{≔}\left[{0.231411169620961532}{,}\left[\mathrm{k__1}{=}{0.0632294154111440}{,}\mathrm{k__2}{=}{0.0186953983808340}{,}\mathrm{k__3}{=}{0.0144413290425876}{,}\mathrm{k__4}{=}{0.}\right]\right]$ (5.1)

Compare Experimental Results to Model

 > $\mathrm{res}≔\mathrm{dsolve}\left(\left\{\mathrm{de1},\mathrm{de2},\mathrm{ic}\right\},\mathrm{parameters}=\left[\mathrm{k__1},\mathrm{k__2},\mathrm{k__3},\mathrm{k__4}\right],\mathrm{numeric}\right):$
 > $\mathrm{res}\left(\mathrm{parameters}=\left[\mathrm{optPars}\left[2\right]\left[\right]\right]\right):$
 > $\mathrm{p_C}≔\mathrm{odeplot}\left(\mathrm{res},\left[\mathrm{t},\mathrm{C__C}\left(\mathrm{t}\right)\right],\mathrm{t}=0..70,\mathrm{color}=\mathrm{ColorTools}:-\mathrm{Color}\left(\left[\frac{149}{255},\frac{165}{255},\frac{166}{255}\right]\right),\mathrm{legend}="C",\mathrm{filled}=\mathrm{true}\right):$
 > $\mathrm{p_C_exp}≔\mathrm{plot}\left(\mathrm{times},\mathrm{C_exp},\mathrm{style}=\mathrm{point},\mathrm{symbol}=\mathrm{solidcircle},\mathrm{symbolsize}=20,\mathrm{color}=\mathrm{ColorTools}:-\mathrm{Color}\left(\left[\frac{149}{255},\frac{165}{255},\frac{166}{255}\right]\right)\right):$
 > $\mathrm{p_D}≔\mathrm{odeplot}\left(\mathrm{res},\left[\mathrm{t},\mathrm{C__D}\left(\mathrm{t}\right)\right],\mathrm{t}=0..70,\mathrm{color}=\mathrm{ColorTools}:-\mathrm{Color}\left(\left[\frac{58}{255},\frac{83}{255},\frac{155}{255}\right]\right),\mathrm{legend}="D"\right):$
 > $\mathrm{p_D_exp}≔\mathrm{plot}\left(\mathrm{times},\mathrm{D_exp},\mathrm{style}=\mathrm{point},\mathrm{symbol}=\mathrm{solidcircle},\mathrm{symbolsize}=20,\mathrm{color}=\mathrm{ColorTools}:-\mathrm{Color}\left(\left[\frac{58}{255},\frac{83}{255},\frac{155}{255}\right]\right)\right):$
 > $\mathrm{display}\left(\mathrm{p_C},\mathrm{p_C_exp},\mathrm{p_D},\mathrm{p_D_exp},\mathrm{symbol}=\mathrm{solidcircle},\mathrm{size}=\left[800,400\right],\mathrm{axesfont}=\left[\mathrm{Calibri}\right],\mathrm{legendstyle}=\left[\mathrm{font}=\left[\mathrm{Calibri}\right]\right],\mathrm{labels}=\left["Time","Concentration"\right],\mathrm{labelfont}=\left[\mathrm{Calibri}\right],\mathrm{labeldirections}=\left[\mathrm{horizontal},\mathrm{vertical}\right],\mathrm{gridlines}\right)$
 > 
 > 
 >