## 3 Balancing Chemical Equations Using Iterations
### Balancing Chemical Equations Using Iterative Methods
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Methods** & **NM** & **CM** & **PM** \\ \hline IT & 14 & 9 & 3 \\ \(\|X_{k+1}-A^{\dagger}\|\quad 2.59961\times 10^{-161}\quad 1.1697\times 10^{-193} \quad 9.09312\times 10^{-293}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The results corresponding to balancing Equation (24). \((2,3,3,6,6,6,6,10,12,15,20,88,2,3,3,6,6,6,10,15,79)^{\rm T}\). The results once again show that PM is the best iterative process._

**Example 4**. : _Consider the following example from [19]:_

\[x_{1}{\rm MnO}_{4}^{-}+x_{2}{\rm H}^{+}+x_{3}{\rm Fe}^{2+}\to x_{4}{\rm Mn}^{2+ }+x_{5}{\rm H}_{2}{\rm O}+x_{6}{\rm Fe}^{3+}\]

_The reaction matrix \(A\) can be derived by taking into account both the law of conservation of atoms and the law of electrical neutrality, and it is equal to (see [19]):_

\[A=\left( \begin{array}{cccccc}1&0&0&-1&0&0\\ 4&0&0&0&-1&0\\ 0&1&0&0&-2&0\\ 0&0&1&0&0&-1\\ -1&1&2&-2&0&-3\end{array} \right)\]

_As in the previous examples, let us denote by \(X\) the result derived by the iterative method Equation (9). The rational approximation of \(s={\tt A}. ({\tt Id-XA})(({\tt Id-XA}). {\tt ConstantArray[1,n]})\) is equal to \(\left\{\frac{2}{11},\frac{16}{11},\frac{10}{11},\frac{2}{11},\frac{8}{11}, \frac{10}{11}\right\}\), and the exact solution coincides with the result given in [19]: \(\{1,8,5,1,4,5\}\)._

**Example 5**. : _In this example, it is shown that our iterative method is capable of producing the solution in the case when the real coefficients are used and the reaction is not unique within relative proportions. Let us consider Reaction 1 with one arbitrary element from [6]:_

\[x_{1}{\rm X}+x_{2}{\rm O}_{2}\to x_{3}{\rm X}_{0.987}{\rm O}+x_{4}{\rm X}_{2}{ \rm O}_{3}+x_{5}{\rm X}_{3}{\rm O}_{4} \tag{28}\]

_The reaction matrix of the homogeneous system Equation (21) is given by \(A=\{\{1,0,-0.987,-2,-3\},\{0,2,-1,-3,-4\}\}\). The iterative method Equation (9) converges quickly, since the list of consecutive errors \(\|X_{k}-A^{\dagger}\|_{\infty}\) is given by

Figure 1: Convergence history for different methods used in Example 3. \(\{0.163381,2.220446049250313\)\(\times\)\(10^{-16}\), \(2.7755575615628914\)\(\times\)\(10^{-16}\}\). The approximate solution \(s=\mathtt{A. (Id-X.A)((Id-X.A).ConstantArray[1,n])}\) is equal to:_

\[s=\{1.40225926604,0.890820221049,0.657559993896,0.35925113635,0.0115817597876\}\]

_and its fractional approximation is:_

\[c=\left\{\frac{44517366795613798}{367684821979411},\frac{103259812167103006}{1 342504707428259},\frac{67799434016501962}{1194167476431641},\frac{5643677260679 2756}{1819443496152855},1\right\}.\]

**Example 6**. : _All possible solutions of the problem considered in Example 5 with respect to \(x1\) and \(x2\) can be generated using the Mathematica function Reduce:_

Reduce[A. ({x1}, {x2}, {x3}, {x4}, {x5}] == {0, 0}, {x1, x2}]

_All solutions in the symbolic form are given as follows (using Mathematica notations):_

\[\mathrm{x1}=\mathtt{0.987x3}+\mathtt{2.0x4}+\mathtt{3.0x5}+\mathtt{0.0}\wedge \mathrm{x2}=\mathtt{0.5x3}+\mathtt{1.5x4}+\mathtt{2.0x5}+\mathtt{0}\]

_wherein \(x3,x4,x5\) are arbitrary real quantities. All possible solutions with respect to \(x1\) and \(x3\) can be generated using:_

Reduce[A. ({x1}, {x2}, {x3}, {x4}, {x5}] == {0, 0}, {x1, x3}]

_All possible \(\binom{5}{2}=10\) cases can be solved in the same way._

**Example 7**. : _As the last experiment and to show that the proposed iteration could preserve the sparsity pattern of the inverses if the inverses are sparse in nature, the following \(4000\times 4000\) matrix \(\mathtt{A}=\mathtt{ExampleData[``Matrix\",``Bai/tols4000\"]}\) has been taken from Matrix Market database with the stopping termination \(\frac{\|X_{k+1}-X_{k}\|_{\infty}}{\|X_{k+1}\|_{\infty}}\leq 10^{-10}\). The new scheme Equation (9) converges in twelve iterations. The matrix plots of the approximate inverse for this case are brought forward in Figure 2._

Figure 2: Cont.