# Writing geo_mean( (1+x/y) ^x )

(John) #1

Dear All,
I want to write a constraint in this form (x>0 and y>0): geo_mean( (1+x/y) ^x )
I think the objective function is convex: (1+x/y)^x
Is it possible to write this constraint in cvx?
Thanks alot

(Mark L. Stone) #2

geo_mean takes a vector as its argument. What vector is the argument of geo_mean?

Then are you claiming convexity, or concavity of that expression, and do you have a proof?

Anyhow, presuming you don’t intend to have geo_mean at all, and are interested in the convex expression, `(1+x/y)^x`, that can be handled as
`(1+x/y)^x = exp(x*log((1+x/y))) = exp(rel_entr(x+y,y) + rel_entr(y,x+y))`
where the latter makes use of the result by @Michal_Adamaszek
`x*log(1+x/y) = rel_entr(x+y,y) + rel_entr(y,x+y)` in your previous question Writing x*log(1+x/y) .

(John) #3

I checked for convexity of (1+x/y)^x and It is convex. But I don’t know if the multiplication of these functions becomes convex too or not?
I just wanna ignore successive convex approximation in my formulations, I know that we can write x*log(1+x/y) in DCP rule-set as well.

(Mark L. Stone) #4

You can use either `exp(rel_entr(x+y,y) + rel_entr(y,x+y))` or `rel_entr(x+y,y) + rel_entr(y,x+y)`, depending on which you want, and avoid CVX’s successive approximation method. To do so, install CVXQUAD https://github.com/hfawzi/cvxquad and its `exponential.m` replacement for CVX’s version, as described on the CVXQUAD page.

Instances of `rel_entr` will then be handled through CVXQUAD’s Pade approximant, which seems in my experience to be much faster and more robust than CVX’s successive approximation method,

If you actually need geo_mean, then please clarify. Note that geo_mean of a scalar is just that scalar. So geo_mean only becomes non-trivial for a vector argument.

1 Like
(John) #5

Thanks alot, I appreciate it. It helped me alot!