Well, I concentrated on the mathematics behind the program and just implemented the basic things, but using advanced and complete mathematics (that is my strength and background, I have done a LOT of math in my work).
I use the program mainly on a small computer in my home lab, such that it can do tedious computations, which I otherwise have to do by hand. Using a small tablet PC, I have a nice chemical calculator, without any frills.
The mathematics behind the program are fairly complicated.
The program first determines a set of linear equations with integer coefficients, for each of the compounds, involved in the equation to be balanced.
This equation can be written as a matrix equation Ax = Bx. This can be rewritten as (A-B)x = 0. I determine the nulll-space of the matrix A-B. If the dimension of the null-space equals 0, then the reaction is not possible. An example of such a reaction is:
CuO + SO2 --> CuSO4
If the dimension of the null-space of the matrix A-B equals 1, then the equation can be solved unambiguously (except for a single factor). This is the situation, which usually occurs with high-school chemistry equations. If the dimension of the null-space is larger than 1 (e.g. 2, 3, ...), then the problem cannot be solved unambiguously. An example of that is given on my website (copper and nitric acid).
What the program also does is not only determining the dimension of the null-space, but it also tries to form a base for the null-space, with all-integer coefficients. Such a base always exists, because the input problem also is all-integer. The program also tries to find all base vectors such that all elements in them are larger than or equal to 0. This is not always possible. Sometimes negative values are needed. If that is the case, then it means that the compounds, which negative coefficients need to be brought to the other side of the arrow. An example of that also is on my website (the vanadium half-reaction in the tutorial page).
You should really try to understand the linear algebra behind the problem of balancing chemical equations. It makes the problem totally and completely solvable.
At the moment I'm thinking about the generic solving of acid/base problems, which takes into account the pKa or pKb values for all involved acids and bases, for all different protons, which can be split off or absorbed. It also takes into account the self-ionization of the solvent. The latter is important at very low concentrations of acids (e.g. 10^-8 mol/l of HCl in pure water has not a pH, equal to 8, but somewhere just below 7).
This is quite an easy problem as well. In general this results in a set of multivariate polynomial equations. These can be transformed to a large single polynomial equation. I already have a generic polynomial equation solver (it is on my website, MPSOLVE, basic algorithm from University of Pisa, I have made the algorithm much more robust, such that any ill-conditioned polynomial can be tackled). This will be the work-horse for the acid/base program. More info about this will follow later, when I have a reasonably working version of the program.