How to express this convex function in CVX

I want to use the convex function f(x)=\frac{\exp(x)-1}{x} with f^{(n)}(x)=\frac{1}{(n+1)!} for n\ge 0 (the figure of this function is provided below

). If I directly input this form in Matlab CVX, the error (‘Cannot perform the operation: {convex} ./ {real affine}’) happens. How to solve it? I want to add it in the CVX library if possible.

It is unlikely to be possible in CVX. You may find the discussion at


Could you please explain it with more details? If this function appears in the objective, how to tackle with it?

The point of @Erling’s post is that the best experts in the world have not figured out how to exactly represent your function in CVX. The best anyone knows how is to implement some approximation, as described in the Mosek blog.

If you want to deal exactly with this function, you will need to use something other than CVX or any other (Extreme) Disciplined Convex Programming tool.

Thank you for your explanation. It seems like the only way is writting an optimization algorithm based on the barrier method by myself.

There are other nonlinear optimization algorithms, for instance available under YALMIP. I doubt there is a need to write your own.

1 Like

Btw no one knows a self concordant barrier for the set

(exp(x)-1)/x <= t

to the best of my knowledge.

I would be extremely hearing about any self-concordant barrier for the set.

Thanks for your advice.

Thank you for your comment. In the optimization problem of my interest, the function \zeta(x), about which we discussed, only appears in the optimization objective other than the constraint.

Even though it only appears in the objective you still need a self concordant barrier for set mentioned
in order to develop a polynomial time algorithm.

Do you have reference to a paper where this function appears so I can see the context.

This optimization problem orginates from my recent research, which involves maximizing the differential entropy of a continuous random variable S on a bounded support [0,1] and under a moment equality constraint and several moment inequality constraints, such as \mathbb{E}\left[\left(S-a_i\right)_+\right]\le c_i ((x)_+=\max\{x,0\}). This entropy-maximized problem is a standard convex optimization. Then I turn to solve the Lagrange dual problem of the original one since the strong duality holds.
The dual problem in a simple case can be given as follows:
\gamma \triangleq \min_{\nu_0 ,\lambda_0;\lambda_1\ge0} \lambda_1c_1 -1-\nu_0-\lambda_0c_0+ \nonumber\\ \int_0^1 \exp \left(\nu_0+\lambda_0 s-\lambda_1 \left(s-a_1 \right)_+ \right) ds

The function \zeta(\cdot) appears when we calculate the integration of such a exponential function.

1 Like

Thanks for the explanation.

At Mosek we would very much like to handle this function but we have not solved the issue yet.