TITLE: Nonlinear optimization with constraints
QUESTION [5 upvotes]: Let $w$ be some vector. I want to solve:
$$ w=\arg\min \sum f_i^2(w) \\s.t. w\geq 0, \sum w_i = 1$$
That can be formulated as follows:
$$ w=\arg\min ||{\bf f}(w)||^2 \\ s.t. \quad H(w)\geq 0, G(w)= 0 $$
where $H(w)=w,G(w)={\bf 1}^T w-1=\sum w_i-1$.
This seems to me a standard problem. The unconstrained problem can be solved using the Gauss-Newton (GN) method. However, I can't seem to find how to solve the constrained problem. Which method should I use? can GN be adapted to these constraints? 
Thank you.
EDIT: 
a. I will add a formula for $f_i(w)$:
$$ f_i(w) = w^T A_i w - z_i$$ where $A_i$ is a symmetric matrix and $z_i$ are known scalars. 
b. Trying to find my answer, I encountered the Levenberg–Marquardt algorithm, which appears almost suitable here, but I do have a matrix $A_i$ and not a scalar that varies with $i$.
c. I thought of doing the following: since in each iteration of solving the Gauss-Newton method I solve a linear LS, I would solve instead a constrained LS with my constraints. Is that a right way to go?
Thanks again.

REPLY [2 votes]: As noted in the comments, this answer does not give an exact solution.
Using an extra variable $t_i$, which is used to model $f_i(w)$, the problem can be represented as a quadratically constrained quadratic optimization problem (QCQP):
$$
\begin{align*}
\min \quad & t_i^2 \\
\mathrm{s.t.} \quad & t_i \geq w^T A_i w - z_i \\
& \sum w_i = 1 \\
& w \geq 0
\end{align*}
$$
You may wonder why the first constraint uses "$\geq$" instead of "$=$". The reason is that it ensures convexity (given two feasible solutions, the line segment between those solutions is also feasible). However, as noted in the comments, the formulation is not equivalent.
The advantage of writing this problem as a QCQP is that there is a plethora of algorithms to solve it. I will focus on interior point methods, which find the (globally) optimal solution in 40-60 iterations independent of the size of your problem. Matlab has quadprog. Commercial software like CPLEX, Mosek, Gurobi has bindings for many languages, including Matlab and Python. QCQP is a special case of convex optimization, so in Python you could use scipy.optimize.