 # Log{convex} log(1+1/(1+x))

log(1+1/(1+x)) is a convex function over a<=x<=b, a,b>0, so how can i implement it in cvx?

Just because it’s convex doesn’t mean CVX can implement it. It does not claim to be able to handy any and all convex problems. Please read the FAQ.

You may be able to use a polynomial approximation; please see the function reference for the use of polyval.

Thank you for quick reply. I also find on the forum a way to do this

Hey that’s a good find! Share here if you find a solution to your particular case.

It’s actually very useful to understand that you really never need to know how to “implement” a function f(x). Rather, you need a way to implement the inequality f(x) \leq y (or, f(x) \geq y if f is concave). Any set of equations that returns the same subset on (x,y) is a valid implementation of f(x) \leq y. That’s what the user is doing in that post.

Consisder another variable y satisfying 1/y=1+1/x. Then, we can minimize the convex objective function -log(y) s.t.a/(a+1) <=y<=b/(1+b)

log(1+1/(1+x))=rel_entr(x+1,x+2)+rel_entr(x+2,x+1)