Given a covariance matrix cov, return the weight vector minimising w' @ cov @ w subject to sum(w) == 1:
cov
w' @ cov @ w
sum(w) == 1
inv(cov) @ 1 / (1' @ inv(cov) @ 1)
Input
[[0.04 0.01] [0.01 0.09]]
Output
[0.72727273 0.27272727]
This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.
solve(...)