How to solve the six elements equations below?

How to get the exact or numerical solutions of the six elements equations below? $$\begin{cases} \frac{c_1}{1-x_1}+\frac{c_2}{1-x_2}+\frac{c_3}{1-x_3}=0\\ \frac{c_1}{1-x_4}+\frac{c_2}{1-x_5}+\frac{c_3}{1-x_6}=0\\ c_1\ln{\frac{x_1}{1-x_1}}+c_2\ln{\frac{x_2}{1-x_2}} +c_3\ln{\frac{x_3}{1-x_3}}=0\\ c_1\ln{\frac{x_4}{1-x_4}}+c_2\ln{\frac{x_5}{1-x_5}} +c_3\ln{\frac{x_6}{1-x_6}}=0\\ \frac{x_1(1-x_1)}{x_4(1-x_4)}=\frac{x_2(1-x_2)}{x_5(1-x_5)}=\frac{x_3(1-x_3)}{x_6(1-x_6)} \end{cases}$$ where $c_1,c_2,c_3$ are constants, and $x_i\in(0,1), i=1,2,3,4,5,6$. Using $y_i=1-x_i$ instead of $x_i$ makes the equations a little more succinct $$\begin{cases} \frac{c_1}{y_1}+\frac{c_2}{y_2}+\frac{c_3}{y_3}=0\\ \frac{c_1}{y_4}+\frac{c_2}{y_5}+\frac{c_3}{y_6}=0\\ c_1\ln{\frac{1-y_1}{y_1}}+c_2\ln{\frac{1-y_2}{y_2}} +c_3\ln{\frac{1-y_3}{y_3}}=0\\ c_1\ln{\frac{1-y_4}{y_4}}+c_2\ln{\frac{1-y_5}{y_5}} +c_3\ln{\frac{1-y_6}{y_6}}=0\\ \frac{y_1(1-y_1)}{y_4(1-y_4)}=\frac{y_2(1-y_2)}{y_5(1-y_5)}=\frac{y_3(1-y_3)}{y_6(1-y_6)} \end{cases}$$

• Have you tried a Nelder-Mead simplex search using the sum of the squared errors as the cost function? Jan 31, 2014 at 2:30

Edit 3: Since we now know that $x_1 = x_4$ and $x_2 = x_5$ and that $x_3$ and $x_6$ are superfluous, I believe that the correct solution to the above system is the set of $(x_1,x_2)$ pairs related by

$$\beta = {{c_1} \over {1-x_1}} + {{c_2} \over {1-x_2}} \\ x_3 = 1 + { {c_3} \over {\beta} } \\ \Rightarrow c_1 \ln \left( { {x_1} \over {1-x_1} } \right) + c_2 \ln \left( { {x_2} \over {1-x_2} } \right) = -c_3 \ln \left( {{-\beta} \over {c_3} } - 1 \right).$$

Since $\ln$ is nonlinear, I don't think the above can be simplified meaningfully.

Edit 2: So I updated the cost function to only use $x_1$, $x_2$, $x_4$, and $x_5$ since both $x_3$ and $x_6$ can be expressed in terms of them. I still get a different solution that depends on the starting point (I choose the four starting points using a random number generator). However, the solution always has the relations that $x_1 = x_4$ and $x_2 = x_5$. This suggests to me that there are still two superfluous relations in the system and I'd guess that the the first two equations can be combined with the last two to remove another two variables so that problem reduces to finding $x_1$ and $x_2$. Until then, I'd say that the problem is currently poorly formulated.

Edit 1: So the below will only get you one particular solution. If I change the initial guess to [0.7; 0.8; rand(1); 0.7; 0.8; rand(1)], I get a different solution each time.

Depending on the values of $c_1$, $c_2$, $c_3$, I can get solutions using the following Nelder-Mead simplex search in Matlab. Note that there is one difference with the equations given above: I assumed that $\ln ( x_6 / (1-x_3) )$ was a typo and that it should be $\ln ( x_6 / (1-x_6) )$, as that fits the pattern of the other equations.

Here is the cost function I used with some arbitrary values chosen for the constants:

function f = costfun(x)

c1 = 100;
c2 = -54;
c3 = 0.354;

if( any( x >= 1 ) || any( x <= 0 ) )
f = inf;
return;
end

f1 = ( c1 / ( 1 - x(1) ) + c2 / ( 1 - x(2) ) + c3 / ( 1 - x(3) ) ).^2;
f2 = ( c1 / ( 1 - x(4) ) + c2 / ( 1 - x(5) ) + c3 / ( 1 - x(6) ) ).^2;

f3 = ( c1 * log( x(1) / ( 1 - x(1) ) ) + ...
c2 * log( x(2) / ( 1 - x(2) ) ) + c3 * log( x(3) / ( 1 - x(3) ) ) ).^2;
f4 = ( c1 * log( x(4) / ( 1 - x(4) ) ) + ...
c2 * log( x(5) / ( 1 - x(5) ) ) + c3 * log( x(6) / ( 1 - x(6) ) ) ).^2;

f5 = ( x(1)*(1-x(1)) / x(4)/(1-x(4)) - x(2)*(1-x(2)) / x(5)/(1-x(5)) ).^2;
f6 = ( x(1)*(1-x(1)) / x(4)/(1-x(4)) - x(3)*(1-x(3)) / x(6)/(1-x(6)) ).^2;
f7 = ( x(2)*(1-x(2)) / x(5)/(1-x(5)) - x(3)*(1-x(3)) / x(6)/(1-x(6)) ).^2;

f = f1 + f2 + f3 + f4 + f5 + f6 + f7;

return;


I then used the following to estimate the solution:

[x, costval, exitflag] = fminsearch( @costfun, 0.5 * ones(6,1) );


For the above values of $c_1$, $c_2$, and $c_3$, I got the following estimate for $\mathbf{x}$ with a total squared error of $3.3112 \cdot 10^{-6}$:

x =

0.7176
0.8477
0.1655
0.7176
0.8477
0.1656


The below plot shows the squared error for each iteration of the Nelder-Mead search:

• Thank you for your method and finding my typo. But may be there is an instance that makes the cost function small, but there is not a solution near it. At least there should be an exact solution near each estimated solution. Jan 31, 2014 at 4:15
• I don't understand how a solution could not be near a value that makes the cost function small. Is it not true that only a solution will make the cost function small? Jan 31, 2014 at 4:17
• May be there is a "solution" makes the cost function less than $10^-6$ but there is not a exact solution near this estimated solution. Jan 31, 2014 at 4:26
• Besides I need to figure out all the solutions of the function. Jan 31, 2014 at 4:28
• I can get the squared error down to $~10^{-18}$ by changing the termination conditions. What are your requirements here? The question asks for exact or numerical solutions to the system of equations. Jan 31, 2014 at 4:31