# Xlog( 1+ Y/(X+Y) ): DCP rules, and build-in functions in cvx

Hi everyone,

I have a function which is exprssed as f = xlog( 1+ y/(x+y) ). I have verified that function f is jointly concave over x and y, but this form is not accepted by CVX. How can I tconvert into a built-in function of CVX?

I have tried to use the -rel_entr( , ) in cvx, but I did not succeed.
Who can provide me any suggestions or hints?

Your help would be highly appreciated.

edit:

We have : xlog( 1+ y/(x+y) ) = xlog( 1+ z/(1+z) ) for z=y/x. and

-rel_entr( x, x+y)= xlog( 1+y/x )

What else can we do?

This can be entered into CVX as
`-2*rel_entr(x+y,x+2*y) - rel_entr(x+2*y,x+y)`

Derivation:
`x*log(1+y/(x+y)) = (x+y)*log(1+y/(x+y)) - y*log(1+y/(x+y))`

The first term is `-rel_entr(x+y,x+2*y)`.

The second term can be handled with the result from the wizard of conic reformulation @Michal_Adamaszek in Writing x*log(1+x/y) , that
`x*log(1+x/y) = rel_entr(x+y,y) + rel_entr(y,x+y)` , which in this case becomes
`-(rel_entr(x+2*y,x+y) + rel_entr(x+y,x+2*y)))`

Nice solution. Thanks!

Hello @Mark_L_Stone , just to be sure, this approach can still be used for a function like xlog(1+ay/(by+x)), where a and b are nonnegative constants. Thus, the CVX expression is -2*rel_entr(x+y,x+(a+b)*y) - rel_entr(x+(a+b)*y,x+y), right?

That is incorrect, as you can easily see by plugging in some “random” values for a,b,x,y and seeing that the numerical values are not equal.

Presuming `x` is the only CVX variable (or CVX expression), you can use the solution in my answer to your previous question at How to represent this expression in CVX - #6 by Mark_L_Stone by using `a*y` in place of y and `b*y` in place of `A`, which yields

``````x*log(1+a*y/(b*y+x)) =
-rel_entr(x+b*y,x+b*y+a*y) - b*y*(rel_entr((x+b*y)/(a*y),(x+b*y)/(a*y)+1) + rel_entr((x+b*y)/(a*y)+1,(x+b*y)/(a*y)))
``````

Thank you so much. And it is not concave jointly in x and y.

It is jointly concave in `x` and `y`. But the expression I provided will not be accepted by CVX unless `y` is input data.

A plot of the function looks concave. But the det(H2)=0.

Is there a way to write that in CVX when both x and y are CVX variables?

Thank you.

Yes, its Hessian has one negative eigenvalue, and one eigenvalue equal to zero. So it is jointly concave in `x` and `y`, but not jointly strictly concave.

If `x` and `y` are both variables, the decomposition I used does not produce a formulation which can be entered in CVX, although it is still mathematically correct. That is because ` A*log(1+y/(x+A)` is neither convex nor concave jointly in `x`; and `y`, and therefore can;'t be reformulated for CVX, even though `x*log(1+y/(x+A))` is jointly concave in `x` and `y`.

I see, thank you again.

Hopefully, someone is able to come up with an expression in CVX for xlog(1+ay/(by+x)), where x and y are variables.

is just xlog( ( (b+a)y+x ) / (by+x) ), therefore use b+a in place of a and b in place of c of

it might work out.

1 Like

@jackfsuia Thanks. I forgot that reformulation you did last year. I liked it and still forgot it.

Thank you @jackfsuia and @Mark_L_Stone . I’ll try that out.