Minimizing function with inequality constraints in R^n

172 Views Asked by At

I have a point $p$ in $R^n$, and I need to find the point $q$ which minimizes a distance function $f(p,q)$ with a number of constraints on $q$ (namely, $q$ needs to represent a probability distribution). I tried to use the Lagrange multipliers method, but I end up with very complicated equations that I don't know how to solve.

Is there any way to calculate it on computer (symbolically), e.g. with Sage? I'm really struggling with that even though it seems like a very simple problem.

Example (but $f$ can also be different): $f(p,q) = \sum{(p_i - q_i)^2}$, $\sum{q_i}=1$, $\forall i: 0 \leq q_i \leq 1$.