# How to write this fomula into CVX expression?

(hua meng) #1

Dear anyone,

How to write the following formula into CVX expression ?

{\log _2}\left( {\sum\limits_{n = 1}^N {\frac{{{a_n}}}{{{b_n} + {x_n}}}} } \right) , where a_n and b_n are positive scalars, and the x_n is variable.

(Mark L. Stone) #2

This is convex for N = 1, and can be entered as log2(a) - log(b+x)/log(2)

But it is neither convex nor concave for N > 1. For instance, let N = 2 and all the parameters and variables have the value 1. Then per Maple, the eigenvalues of the Hessian are -0.40856482 and 0.31839638

You should carefully re-read Why isn't CVX accepting my model? READ THIS FIRST! .

Edit: There was a typo in my Maple entry. So I withdraw the above assessment.

(hua meng) #3

Dear Mark,

For N>1, For instance N=2, I think it is still convex. please see below;

(Mark L. Stone) #4

Sorry, the function is convex at those parameter and variable values. There was a typo in my Maple entry. I have now withdrawn the non-convex determination, but have not shown that it is indeed convex for all positive parameter values and all variable values for which the argument of log is positive.

I’m guessing this will be a piece of cake for the wizard of conic reformulation, @Michal_Adamaszek

(hua meng) #5

Dear Mark,

I think it is convex when N=2 with any positive parameter values and positive variable values. I prove it by checking hessian matrix.

The figure shows the eigenvalues of the Hessian are all positive, thus convex.

Challenge accepted. Here is the plan. After some linear substitutions we need to model t\geq\log(\sum\frac{1}{y_i}), which I guess could be called log-sum-inv. Now e^{z_i}\geq \frac{1}{y_i} is representable because it is just y_i\geq e^{-z_i} so we can write t\geq\log(\sum e^{z_i})\geq \log(\sum\frac{1}{y_i}), where the first part is the standard log-sum-exp.

I think this may also apply to some other log-sum-blah functions that we have seen in this forum before.

(hua meng) #7

Dear Michal,

I get it. Thank for very much.