I have to solve the following system made of two equations.
- The variables are $x_i$ for $i=1,...,n$.
- For the parameters, we have $a_i\in\mathbb{R}$ and $B\geq0$.
The two equations are: $$\sum_{i=1}^na_i\cos(x_i)=B,$$ $$\sum_{i=1}^na_i\sin(x_i)=0.$$
I see a condition of existence: we must have $B\leq \sum_{i=1}^n|a_i|$.
But are there any other conditions? And my main question is: how could I find a solution to such equations?
Thanks for you help!

We can reformulate the problem using complex exponentiation
$$B - \sum_{i=1}^n a_i s_i = 0$$
$$s_k = \exp(i x_k)$$
And interpret it as a polygon space of varied angles in vertices. It doesn't look like a simple problem. This may be of use:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.237.2549
(You might also want to ask it on MathOverflow.)