The Mathematica Journal
Feature Articles
New Products
New Publications
News Bulletins
Write Us
About the Journal
Staff and Contributors
Back Issues
Download this Issue

A Simple Chemical Equilibrium Calculation: Phosphoric Acid

The initial step is to load the BioEqCalc package.


Example 1.

The first step in a chemical equilibrium calculation is to define the chemical reactions comprising the system of reactions. This is done by defining the variable system.


Note that double quotes are used at the beginning and end of these four reactions and that commas serve to separate the reactions from each other. It is essential to allow at least one space between the equal signs and the species as well as between the species themselves. Charges are written as a part of the chemical species and are specified as in the above example (i.e., use -2 and not 2-). In the absence of a charge, the charge is assumed to be zero.

Next, the function makeInput[] is used to extract essential information from the variable system.


Although not shown in this output, the transpose of the stoichiometric number matrix [Graphics:../Images/index_gr_46.gif] and the vectors containing the species and the charges of the species have been automatically generated. These can be displayed.


Note that the ions [Graphics:../Images/index_gr_51.gif]and [Graphics:../Images/index_gr_52.gif] have been automatically added to the list of species. This has been done so that appropriate amounts of these species can be added to the solution later, if necessary, to maintain electrical neutrality. In the above example, [Graphics:../Images/index_gr_53.gif] was present as a reactant. If this was not the case, it would also have been added to the list of species in the system.

The next step is to provide the data needed to define the problem. This is done by giving the following parameters to the function reactions[].

[Graphics:../Images/index_gr_54.gif] [Graphics:../Images/index_gr_55.gif]
[Graphics:../Images/index_gr_56.gif] [Graphics:../Images/index_gr_57.gif]
[Graphics:../Images/index_gr_58.gif] [Graphics:../Images/index_gr_59.gif]
[Graphics:../Images/index_gr_60.gif] [Graphics:../Images/index_gr_61.gif]
[Graphics:../Images/index_gr_62.gif] [Graphics:../Images/index_gr_63.gif]
[Graphics:../Images/index_gr_64.gif] [Graphics:../Images/index_gr_65.gif]
[Graphics:../Images/index_gr_66.gif] [Graphics:../Images/index_gr_67.gif]
[Graphics:../Images/index_gr_68.gif] [Graphics:../Images/index_gr_69.gif]
[Graphics:../Images/index_gr_70.gif] [Graphics:../Images/index_gr_71.gif]
[Graphics:../Images/index_gr_72.gif] [Graphics:../Images/index_gr_73.gif]
[Graphics:../Images/index_gr_74.gif] [Graphics:../Images/index_gr_75.gif]
[Graphics:../Images/index_gr_76.gif] [Graphics:../Images/index_gr_77.gif]
[Graphics:../Images/index_gr_78.gif] [Graphics:../Images/index_gr_79.gif]
[Graphics:../Images/index_gr_80.gif] [Graphics:../Images/index_gr_81.gif]
[Graphics:../Images/index_gr_82.gif] [Graphics:../Images/index_gr_83.gif]

In the following example, constrainedSpecies has no entries and constpXa is also empty. Note that nt, species, and charge are generated by makeInput[]. The parameters reactants, pseudo, and ntprime have been left empty. The output should be used to check the accuracy of the data that has been entered.


The solution of the equilibrium problem is obtained by using ionicEquilib[]. All of the parameters have already been defined with the exception of the following.

[Graphics:../Images/index_gr_93.gif] [Graphics:../Images/index_gr_94.gif]

The vector containing the molalities m of the species and the ionic strength I at equilibrium are calculated.


Converted by Mathematica   

[Article Index] [Prev Page][Next Page]