# DCP with this convex function?

Hi there,

I have a question to the community: I would like to use the function f(x, y) = \frac{y}{2}(\frac{x}{y} -c)^2 for scalar variables x and y>0 and a constant c. This function is convex, however it is not recognized as such by cvx. I have been scanning through the available cvx functions but none seemed to be suitable.

Does anybody have an idea for a workaround?

Thx for any help!

You have

f(x,y) = 0.5 (\frac{x^2}{y} + c^2 y - 2 c x)

Maybe CVX understand that. Otherwise using a rotated quadratic cone it can easily be made DCP compliant:

\begin{array}{rcl} f(x,y) &=& 0.5 (2 z+ c^2 y - 2 c x) \\ 2 z y & \geq &x^2 \\ z,y & \geq & 0 \end{array}

Last two inequalities are a rotated quadratic cone.

2 Likes

Thank you. The function quad_over_lin(x,y) does the job for the first solution.

Yes of course.

CVX converts to the form I mentioned at its backend I suppose.