python - How to minimize matrix w with given equation and conditions? -
w 3*1 matrix , want minimize (w'seccovw), given w'*secmu = 6.5, w'*1 = 1. thank you!
import pandas pd import numpy np scipy.linalg import solve scipy import optimize seccov = np.matrix('1 2 3, 4 5 6, 7 8 9') secmu = np.matrix('1.1 1.2 1.3').t def minfunc (w, cov): return w.t*cov*w
Comments
Post a Comment