# General quad over lin

Hi, I have a kind of straightforward question and maybe my mind has been stuck somewhere.

I have a objective function appear in the form \frac{ax^2 + bx + c}{y}, where x,y > 0 are the variables, and a,b,c > 0 are known coefficient, which is convex. I did not come up how to implement the code properly to use it as my objective function.

Many thanks for the help and reminder.

It can always be written as \frac{a(x+p)^2+q}{y}.

If q< 0 it is not convex (at least not for all y>0).

If q\geq 0 it is a*quad_over_lin(x+p,y)+q*inv_pos(y), modulo my syntax errors.

Many thanks for the reply.

Exactly as you mentioned, it can be tackled this way, yet the feasibility depends on q.

While in a general sense,  \frac{ax^2 + bx + c}{y}, with x,y > 0 are the variables, and a,b,c > 0 are known coefficient, is convex, as it Hessian is positive semidefinite.

So I wonder if there is a way to tackle  \frac{ax^2 + bx + c}{y} universally without dependence on q, as my program may repeat many times with different values of coefficients.

Thanks again for the help.

If a and q donâ€™t have the same sign, it is not convex. If a > 0 as you wrote, that means q > 0 is needed for convexity.

To make a concrete example, the function \frac{x^2+4x+1}{y} is not convex on x,y>0.

More generally, if \frac{a(x+p)^2+q}{y} is convex on x,y>0 then it remains convex on the line x=y-p and that is just ay+q/y on the set y>p which is convex if and only if q>0.

Hi, Mark and Michal,

Many thanks for your detailed reply. You are definitely right. I was taking granted for the positive definiteness of a matrix with positive diagonals and negative non-diagonals.