Hello


this is programm to minimize function by Lagrange Multiplier method with three variables: (h the function ,g is the constraint)
syms x,y,z, lam
gradh = jacobian(h,[x,y,z])
gradg = jacobian(g,[x,y,z])
lagr = gradh - lam*gradg


My question is:
how can I do if I have in the function N variables??
(Example:f=sum 2*x_i ) i=1:k


And thank you