# How to express a function satisfies DCP?

I have a function that is
\sum_{i} $\log(x_{i}+A_{i}) - \log(x_{i}+B_{i})$
where x_{i} is the ith element of a vector X, and A and B are some constant vectors, we also have A_{i} \leq B_{i} for all i.
This a concave function. I want to maximize it.
But it is the form of concave function - concave function.
I tried to figure it out, but I do not find a proper way.

It’s not clear to me that CVX can handle this.

Thanks, Michael.
Just a suggestion, I searched the forum, I found someone they have the same problem like me.
For scaler x or a vector \mathbf{x}, \log(1+\frac{1}{x}) or \sum_{i} \log(1+\frac{1}{x_{i}}) where x_{i} is the i-th element of \mathbf{x}, it is a concave function.
Do you mind adding it to functions of CVX?
Thanks again for your answer. Probably I have to use the other tools to solve this problem.
Best regards,
Ke

As the FAQ discusses, you can’t simply add a new function to CVX, even if it is convex. If it cannot be expressed according to existing DCP rules, there’s simply no way CVX can handle it.

I think the OP is making a request to have such a function added to CVX by the developer, such that CVX will do whatever problem reformualtions are needed to make it work, rather than requiring the user to use rel_entr.

That’s just it, I don’t think such reformulations exist in this case.

x*log(1+y/x) can be reformualted to be accepted by CVX, as you showed in Perspective function .

Of course. But can this be used to formulate the exact function requested here?

I interpreted as fulfilling the first of the listed functions in the extract below. I think such a suggestion has been made previously on this forum, and it has been noted that it seems to arise a lot.

That would still leave the OP out of luck on the function in the first post of this thread.

Fair enough. My interpretation was that the OP mistakenly thought that the x\log(1+1/x) case could be adapted to theirs.