# How to express sqrt(1/x+1) by CVX?

hello everyone!I met a problem about how to express sqrt(1/x+1) by CVX?I demonstrate mathematically that when 0 < x < 0.75, sqrt(1/x-1) is convex,but CVX rejects it.I konw 1/x is convex,sqrt(x) is concave,so CVX can’t judge that if sqrt(1/x+1) is convex.But everyone knows sqrt(1/x+1) is convex when 0<x<0.75.Although i define 0<x<0.75,it doesn’t work.So, How on should I express it?thank you for your answer,please help me

sqrt(1/(x+1)) is convex for x > -1.

Use
pow_p(x+1,-1/2)

You will benefit from re-reading (or reading for the first time) http://cvxr.com/cvx/doc/funcref.html#new-functions, as well as the rest of the CVX Users’ Guide.

i’m so sorry that i didn’t express clearly.the equation is sqrt((1/x)+1)

Let’s look at t\geq (\frac{1}{x}+1)^p for p>0.

The case p=\frac12 is a bit more elementary because the inequality is equivalent to x(t-1)(t+1)\geq 1, which you can do with a geometric mean of the three factors on the left.

For general p we can write

\log{t}\geq u\geq p\log(\frac{1}{x}+1),

where the left inequality is just the concativity of logarithm and the right one is convex and was discussed on the forum before. It is also in https://docs.mosek.com/cheatsheets/conic.pdf

2 Likes

thank you,it works.

Hi,

Sir, I want to write D-sqrt(x^2-A^2) in cvx. Could you please help me writing it in cvx.

Thanks

Do not reply to an old unrelated question. Post a new one.

Plz reply to my new post. Sqrt of (x^2-a^2) in cvx
Thanks in advance