Loop for minimizing functions with a varying number of arguments

Yes, but at each iteration the vector of arguments is different. For exemple, if k=6 I have the vector beta1,beta2,beta3,beta4,beta5,beta6 but if k=50 the vector wil be beta1,beta2, ..., beta50 (I don’t know how to create an argument with so many variables btw… :frowning: ). I need all the components of the vector to appear as they are the arguments to minimize the function.