For an elementary bimolecular reaction involving two species,
the rate law may be formulated in two (entirely equivalent) ways:
or
We only have one differential equation and can from that only obtain
one function, not both A and B independently. The additional
constraint we need is the mass balance. Assuming the stoichiometric
coefficients are a = b= 1, we have
and can use that to eliminate B[t] from the differential equation.
Applying DSolve to the result
 | ans=DSolve[{a'[t] == -k*a[t]*(b0-a0 +a[t]), a[0]==a0}, a[t], t] |
Mathematica provides the answer in the form of a replacement rule. To
get the result in a format that can be fed into Mathematica for
evaluation, you must evaluate the rule. At the same time, it is
convenient to make a[t] into a function. Both of these tasks
can be accomplished with the command
 | a[t_]=a[t]/.ans |
which tells Mathematica to create the function a[t] using the
rule specified by ans. If this is not self-evident please review
the syntax of such ``patterns", ``function definitions" and
``replacement rules" in sections 1.6 and 1.7 of MSE, and in the
introductory exercises!
Q: Plot the concentration as a function of time.
Q: Do this part over for a reaction in which species A combines
with two other A's, giving third order kinetics for the destruction of
A. First state the rate law, and then use Mathematica to solve and
plot data for a typical case.
Hannes Jonsson
Modified by Thomas L. Marchioro II
and the Undergraduate Computational Engineering and Science project