# How to type the w'R/(w'Vw) >= m with CVX?

how to type the (w’R) /(w’Vw) >= m with CVX?

You haven’t told us what the variables are, so I will presume only the vector `w`.

if `V` is psd, multiply both sides by `w'*V*w`, resulting in
`w'*R >= m*w'*V*w`
which is a convex quadratic inequality constraint which will be accepted by CVX.

If `V` is not psd, the constraint is non-convex, and can’t be used in CVX.

thanks, I have another question, w and R are n-dimension vectors, V is a n*n covariance matrix , the problem is
max w’R /sqrt(w’Vw)

I write the code like this,

cvx_begin
variable w(n)
maximize ((w’*R)/(sqrt(w’Vw)))
subject to
Ones’*w == 1
cvx_end

but it doesn’t work, and the error is Illegal operation: sqrt( {convex} ). how can I solve this problem? thanks a lot

This is addressed in section 3.3.4 “Maximizing the Sharpe ratio” of https://docs.mosek.com/modeling-cookbook/cqo.html#conic-quadratic-case-studies

I will leave the translation of that into CVX code as an exercise for you, so that you will learn something. Accordingly, you will have to read the earlier parts of the link in order to understand that section, and you will have to read the CVX Users’ Guide http://cvxr.com/cvx/doc/