A Simple Chemical Equilibrium Calculation: Phosphoric Acid
The initial step is to load the BioEqCalc package.
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
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
Next, the function
Although not shown in this output, the transpose of the stoichiometric number matrix and the vectors containing the species and the charges of the species have been automatically generated. These can be displayed.
Note that the ions and 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, 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
In the following example,
The solution of the equilibrium problem is obtained by using
The vector containing the molalities m of the species and the ionic strength I at equilibrium are calculated.
Converted by Mathematica