I am interested in analytical solutions for a system of nonlinear equations.


(The question was first asked at [math.SE](https://math.stackexchange.com/questions/1763201/closed-form-solution-for-system-of-simple-nonlinear-equations), where (after 1months and one rounds of bounty) there is only interesting analysation that the problem corresponds to high-order polynomial. I'm hoping to get more insight here, in particular whether there are methods which can deal with such high-order polynomials or whether it is likely to be not possible to solve it).


**Motivation**: The source of the question is a very convinient method to [create random matrices with special properties](https://stackoverflow.com/questions/36726844/matlab-fast-creation-of-random-symmetric-matrix-with-fixed-degree-sum-of-rows). Mathematica can give me solutions up to certain sizes of the linear system, but I would like to have it for arbitrary size N. I can also use numerical algorithms (which I am doing at the moment), but for N in the order of $N\approx10.000$, they are quite slow.


**System of nonlinear equations**: 


$$
(w\_i \cdot \sum\_{j=1}^N w\_j) - w\_i^2 = d\_i
$$
for $i=1...N$, and $w$ and $d$ are vectors with $N$ dimensions, and $w\_i$ and $d\_i$ is the $i$-th component of the vector. Both $d\_i$ and $w\_i \in \mathbb{R\_+}$. I am providing the vector $d$ (i.e. N real non-negative numbers), and want to solve for $w\_i$.



> 
> How can $w\_i$ be written down in a closed-form for a given vector $d$, for arbitrary N?
> 
> 
> 




---


**Example:** If N=3 we have the following system of equations:


$$
w\_1 \cdot (w\_2 + w\_3) = d\_1 \\
w\_2 \cdot (w\_1 + w\_3) = d\_2 \\
w\_3 \cdot (w\_1 + w\_2) = d\_3
$$


with $w\_i, d\_i \in \mathbb{R}$. For a given vector $d=(d\_1,d\_2,d\_3)$, I want to get $w=(w\_1,w\_2,w\_3)$.




---


**Rewriting:** There is a nice way to rewrite the question, but I am not sure whether it actually helps:


Let's set $c=\sum\_{j=1}^N w\_j$, which is the sum of all weights. What we have now:


$$c \cdot w\_i - w\_i^2 = d\_i \\
w\_i^2 - c \cdot w\_i + d\_i = 0
$$
which has two solutions:


$$w\_{i\_{1,2}} = \frac{c}{2} \pm \sqrt{ \left(\frac{c}{2}\right)^2 - d\_i}
$$
and the normalisation constant $c$ can be calculated by the sum of all weights:


$$\sum\_{j=1}^N w\_j = \sum\_{j=1}^N \left(\frac{c}{2} \pm \sqrt{ \left(\frac{c}{2}\right)^2 - d\_j} \right) = c
$$


Is there a closed-form solution for c?




---


**Analysation from math.SE:** 
For completness, I copy the analysation of [Robert Israel](https://math.stackexchange.com/questions/1763201/closed-form-solution-for-system-of-simple-nonlinear-equations/1767747#1767747) at math.SE:


$n=3$ is rather easy: $w\_i$ satisfies a quadratic polynomial.


For $n=4$, each $w\_i$ satisfies a rather nasty polynomial of degree $8$
(but involving only even powers). Thus there is a solution in terms of radicals, but it won't be pleasant.


For $n=5$, it seems each $w\_i$ satisfies a polynomial of degree $22$.
A solution in radicals is not to be expected. Thus with $d\_1 = -7, d\_2 = 3, d\_3 = 9, d\_4 = 7, d\_5 = 8$, $w\_5$ satisfies
$$ 81\,{w\_{{5}}}^{22}+7074\,{w\_{{5}}}^{20}+198792\,{w\_{{5}}}^{18}+2887764
\,{w\_{{5}}}^{16}+23487600\,{w\_{{5}}}^{14}+99587008\,{w\_{{5}}}^{12}+
69082752\,{w\_{{5}}}^{10}-1402988992\,{w\_{{5}}}^{8}-6995300352\,{w\_{{5}
}}^{6}-14191984640\,{w\_{{5}}}^{4}-13095665664\,{w\_{{5}}}^{2}-
4492099584 = 0
$$


EDIT: This is an irreducible polynomial of degree $11$ in $x = w\_5^2$. Maple doesn't do Galois groups of polynomials of degree $11$, but GAP does, and confirms that its Galois group is $S\_{11}$. In particular, there is no
solution in radicals.



Closed-Form solution for system of simple nonlinear equations
It isn't clear to me that the solution is unique, even with the positivity restriction.


But, anyway, one practical method that sometimes works is to find an iteration that converges. My first attempt is this:
$$ w'\_j = \frac{d\_j + w\_j^2}{\sum\_{i=1}^n w\_i}.$$
For example, if $n=4$ and $d=(1,\frac12,3,4)$, starting with $w=(1,1,1,1)$ it converges to $w=(0.2133500083,0.1042484319,0.7171275770,3.865757626)$.
However the convergence is rather slow and I guess it will be even slower for large $n$. Another possibility is Newton-Raphson iteration. 


