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

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

**mcg**(Michael C. Grant) #2

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.

**mcg**(Michael C. Grant) #3

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

.

**Kirti_Kant_Sharma**(Kirti Kant Sharma) #4

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

**mcg**(Michael C. Grant) #5

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.

**zhangqirui814**(Zhangqirui814) #6

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)