asifsameer
(Muhammad Asif)
December 2, 2022, 8:03pm
1
After carefully reading the previous threads related to rel_entr function of cvx. We have the following transformations in hand:

```
1) rel_entr(x,y)=x.*log(x/y)
2) -rel_entr( x, x+y)= x*log( 1+y/x )
3) x*log(1+y/(x+y)) = -2*rel_entr(x+y,x+2*y) - rel_entr(x+2*y,x+y)
4) x*log(1+x/y)=rel_entr(x+y,y) +rel_entr(y,x+y)
```

Question: I want to know that how can we express the following expression using rel_entr function?

`x*log(1+y1/x+y2)`

,
where it is confirmed that this is a concave function for x>0. y1 and y2 are constant values. Please note that y1 and y2 are not equal.

It will be really appreciated if someone can address the above notes problem. Thanks!

Moderator edit
5) `log(1 + 1/x) = rel_entr(x,x+1) + rel_entr(x+1,x)`

Presuming there is not a missing parenthesis in your post:

```
x*log(1+y1/x+y2) =
x*(log(1+(y1/(1+y2))/x) + log(1+y2)) =
-rel_entr(x,x+y1/(1+y2)) + x*log(1+y2)
```

asifsameer
(Muhammad Asif)
December 2, 2022, 8:48pm
3
Dear Mark! Many thanks for your kind response. I think there is some confusion due to parenthesis. Let me recast my fucntion again as follows:

`x*log(1+(y1/(x+y2)))`

Your response will be really appreciated. Many Thanks!

It looks like you already found most of my relevant posts.

refers to

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)))
and then finished off with

However, in Writing x*log(1+x/y) ,the wizard of conic reformulation,@Michal_Adamaszek
produced the result
x*log(1+x/y) = rel_entr(x+y,y) + rel_entr(y,x+y)
Setting x = 1, then Interchanging the roles of x and y so as to match the problem in this thread, results in
log(1 + 1/x) = rel_entr(x,x+1) + rel_entr(x+1,x)
The RHS is accepted by CVX, and as a bonus, is already in a form needed by CVXQUAD. It executes without error.
And you can see how to formulate the matrix analog using CVXQUAD’s q…

So essentially the same techniques can be used here.

`x*log(1+y1/(x+y2)) = (x+y2)*log(1+y1/(x+y2)) - y2*log(1+y1/(x+y2)) = -rel_entr(x+y2,x+y2+y1) - y2*(rel_entr((x+y2)/y1,(x+y2)/y1+1)+rel_entr((x+y2)/y1+1,(x+y2)/y1))`

asifsameer
(Muhammad Asif)
December 6, 2022, 5:04am
5
Dear Mark Sir! Many thanks for your kind support.

dear mark, how do represent log(x+y1+y2), y2 only constant?

Provided that each of x, y,1, y2 are constants, CVX variables, affine expressions, or concave expressions, ` log(x+y1+y2)`

can be entered directly as is.