|
Solving a nonlinear equation system |
Top Previous Next |
|
Engineers often wish to solve a nonlinear system of equations often in a chemical equilibrium or oil refining context. Many such problem types exist. A simple form of one follows as adapted from the GAMS model library and the paper Wall, T W, Greening, D, and Woolsey , R E D, "Solving Complex Chemical Equilibria Using a Geometric-Programming Based Technique". Operations Research 34, 3 (1987). which is
ba * so4 = 1 baoh / ba / oh = 4.8 hso4 / so4 / h =0 .98 h * oh = 1 ba + 1e-7*baoh = so4 + 1e-5*hso4 2 * ba + 1e-7*baoh + 1e-2*h = 2 * so4 + 1e-5*hso4 + 1e-2*oh
which is a nonlinear system of equations where the variables are ba, so4, baoh, oh, hso4 and h. The simplest GAMS formulation of this is (nonlinsys.gms)
Variables ba, so4, baoh, oh, hso4, h ; Equations r1, r2, r3, r4, b1, b2 ; r1.. ba * so4 =e= 1 ; r2.. baoh / ba / oh =e= 4.8 ; r3.. hso4 / so4 / h =e= .98 ; r4.. h * oh =e= 1 ; b1.. ba + 1e-7*baoh =e= so4 + 1e-5*hso4 ; b2.. 2 * ba + 1e-7*baoh + 1e-2*h =e= 2 * so4 + 1e-5*hso4 + 1e-2*oh ; Model wall / all / ; ba.l=1; so4.l=1; baoh.l=1; oh.l=1; hso4.l=1; h.l=1; Solve wall using nlp minimizing ba; |