# For convex function: Disciplined convex programming error: Cannot perform the operation: {real affine} .* {convex}

I am solving a convex problem using CVX, the code is

``````cvx_begin
variable T nonnegative
variable t nonnegative
minimize (t*(exp(d*inv_pos(t)-1) +inv_pos(T^2)
subject to
T >= c;
at +bT <=0;
cvx_end
``````

a and b are constant, which is a randomly generated real number. c and d are pre-defined positive constants.
As I checked, the objective function is convex, yet I receive the consequence of

Disciplined convex programming error:
Cannot perform the operation: {real affine} .* {convex}.

What should I do? Looking forward to the help.

The objective can be reformulated as:

`-rel_entr(t,t+d) + pow_p(T,-2)`

So unless you are missing a minus sign, the first term is concave and the 2nd term is convex. Therefore it is neither convex nor concave, and can’t be formulated for CVX. If you are missing a minus sign in the first term, here you go.

EDIT; This answer is wrong because I misread the problem. See my post below.

As far as I know, the rel_entr is function related with log function.
However, my function is in the form of t*exp(1/t), which is convex.
Are you saying I should apply variable substitution?

Whoops. I misread the exp as log (and the -1 at +1).
Edited version:

This should work:

``````variable  z
minimize(z + inv_pos(T^2) )
{d-t,t,z} == exponential(1)
``````

plus the other stuff

THIS WORKS.
Thank you sooooo much for the help.

But not correctly. I just corrected my previous post.