# How to solve this nearly-linear optimization problem, or transform to quadratic form?

A common problem from chemical thermodynamics is to determine the vector $$x_i$$ with dimension $$N$$ that solves

$$\frac{n_i-x_i}{1-\sum x_i} = k_i \frac{x_i}{\sum x_i}$$

for some constant vectors $$n_i$$ & $$k_i$$, subject to the constraints $$\sum n_{i}=1$$, $$1>n_i>x_i>0$$, and $$k_i>0$$, and additionally (to exclude most degenerate cases) $$k_i≠1$$, $$\exists k_i|k_i>1$$, and $$\exists k_i|k_i<1$$. When it exists, $$x_i$$ is unique.

With $$s_i=1$$ and diagonal matrix $$K_{ii}=k_i$$, the problem is

$$\mathbf n = \left(I\, + \, \left(\frac 1 {\mathbf s\cdot \mathbf x} - 1\right)K\right) \cdot \mathbf x.$$

Is there a closed-form expression for $$x_i$$? Can the problem be transformed into standard form for quadratic programming?

Edit:

This corresponds to solving with "volatilities" in chemical language, but I suspect the general case of "saturation pressures" actually has a simpler solution.

This is only a partial answer. Set $$A := ns^T$$. Multiplying your equation with $$s^Tx = \sum x_i$$ gives $$(ns^T)x = Kx + s^Tx(I-K)x,$$ hence $$(I-K)^{-1}(A-K)x = (\sum x_i)x.$$ Thus, we have $$Bx=(\sum x_i)x$$, where $$B := (I-K)^{-1}(A-K)$$. Hence,
Claim: The original system (with constraints) has a solution if and only if $$B$$ has a positive eigenvalue with a corresponding positive eigenvector. In this case, if $$Bu=\lambda u$$ with $$\lambda > 0$$ and $$u>0$$, then $$x = \lambda(\sum u_i)^{-1}u$$ is a solution of the original system.
• Can the related problem (solving with "saturation pressures and finite liquid volumes" in chemical language) be solved similarly, $(n\,s^T - K)x = (s^Tx)x - (v^Tx) K x$ with $v_i>0$ and $0 < v^Tx < 1$? – alexchandel Jan 6 at 22:52