# Chemical Equilibrium Problem

TomSym implementation of GAMS Example (WALL,SEQ=76)

A Sample Nonlinear system to solve Chemical Equilibrium models.

Wall, T W, Greening, D, and Woolsey, R E D, Solving Complex Chemical Equilibria Using a Geometric-Programming Based Technique. OR 34, 3 (1987).

```toms ba so4 baoh oh hso4 h

r1 = {ba*so4 == 1};
r2 = {baoh/ba/oh == 4.8};
r3 = {hso4/so4/h == .98};
r4 = {h*oh == 1};

b1 = {ba + 1e-7*baoh == so4 + 1e-5*hso4};
b2 = {2*ba + 1e-7*baoh + 1e-2*h == 2*so4 + 1e-5*hso4 + 1e-2*oh};

x0 = {1 == ba; 1 == so4; 1 == baoh
1 == oh; 1 == hso4; 1 == h };

solution = ezsolve(ba,{r1,r2,r3,r4,b1,b2},x0);
```
```Problem type appears to be: lpcon
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Problem 1                      f_k       1.000004657593424700
sum(|constr|)      0.000000000000846545
f(x_k) + sum(|constr|)      1.000004657594271200
f(x_0)      1.000000000000000000

Solver: snopt.  EXIT=0.  INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied

FuncEv    1 ConstrEv    4 ConJacEv    4 Iter    3 MinorIter    3
CPU time: 0.015625 sec. Elapsed time: 0.016000 sec.
```