Mean Variance Optimal Portfolio

You may get better help if you post a self-contained minimal working example that highlights where you got stuck. The above code is not that, but a couple of comments:

  1. length may denote a variable, but it is also a function in Julia, use something like lengths or len (cf c(...) in R). Or did you mean length(...)?
  2. You can use ' for transpose.
  3. You can use Greek letters (try typing \mu and press TAB), your code will be much more compact.
  4. If n is an integer, ones(n) will give you a vector of 1.0s. Use I for the identity matrix.

Also, please delimit your code with ```julia … ```.