For a given set of assets and their statistics, i.e., the means and the covariance matrix, we compute the efficient frontier on which for each return value the standard deviation is minimized while varying the combination of the assets.
In practice, suppose that we have n assets. Let mu[1], mu[2], ..., mu[n] be their mean returns, or the mean vector in short. Let V, a n by n matrix, be the covariance matrix of the asset return. Both the mean vector and the covariance matrix can be computed from the daily samples of the asset returns over a certain period of time, say one year. The problem is to find a n-dim vector w, such that for a particular r_e:
To solve the above constrained minization problem, we use the Lagrangian multipliers lambda1 and lambda2, such that the Lagrangian