I am stuck with a problem where I am trying to find a minimum-variance-portfolio, with the budget constraint, hence using the Lagrangian.
I have defined my variance-covariance-matrix as follows. The four unknown variables are the three weights and lambda. The Lagrangian is defined, and I want to use "solve" on the four equations below to get the four results. Since the variance-covariance matrix contains actual numbers, I should get actual numbers (i.e. asset weights) after putting the four equations with four unknowns into "solve", but it does not work at all and I don't know why.
Perhaps one can help.
Sigma = [0.04,0.023,0.045;0.023,0.03,0.02;0.045,0.02,0.06];
syms w1 w2 w3 lambda ;
risk = [w1,w2,w3]*Sigma*[w1;w2;w3];
Lagrangian = risk + lambda*(w1+w2+w3-1);
vals = solve(diff(Lagrangian,w1)==0,diff(Lagrangian,w2)==0,diff(Lagrangian,w3)==0,diff(Lagrangian,lambda)==0);