I have a function to minimize:
$f(a_1,a_2,a_3,a_4)=\sum_{i=1}^n\left(\sum_{k=1}^3 a_k\ p_i^k -a_4\right)^2$
subjected to this constraint:
$a_1^2+a_2^2+a_3^2=1$
and
$a_4\geq0$
I am trying to cast it in least square principles and Lagrange multiplier and solve it, but I am not quite sure how to do it.
The reason I want to do it this way is because I want to leverage existing library like alglib to solve it, it contains the least square principle toolbox, but it doesn't contain least square principles with Lagrange multiplier.
Any idea how to cast this problem in a appropriate format that can be attacked by standard numerical libraries?