# How to express (1-2*z)*log(1+y*theta2/(1-2*z)) into CVX form?

Dear experts,
My procedure is written as follows:

+++++++++++++++++++++++
Pbd=10;
Dbd=10;
Ddr=15;
Ddc=12;
noise=0.00000000011000;
conversion=0.8;
h1=0.69;
h2=0.65;
h3=0.58;
Hbd=h1
Dbd^(-3);
Hdr=h2Ddr^(-3);
Hdc=h3
Ddc^(-3);
ps=0.4;
w1=1;
w2=0.2;
theta1=(conversionpsPbdHbdHdc)/noise;
theta2=(conversionpsPbdHbdHdr)/noise;
theta3=log2(1+((1-ps)PbdHbd)/noise);

%%
cvx_startup;
cvx_begin
variables x y z r;
rdr=(1-2z)log(1+ytheta2/(1-2z));
rbd=zlog(1+((1-ps)PbdHbd)/noise);
rdc=z
log(1+x*theta1/z);

maximize (w1r+w2rdr);
subject to
x+y<=z;
r<=rbd;
r<=rdc;
x>0;
y>0;
z>0;
1-2z>0;
cvx_end
++++++++++++++++
And the error is:
Setting CVX paths…done.

(line 173)
Disciplined convex programming error:
Cannot perform the operation: {real affine} ./ {real affine}

z = times( x, y, ‘./’ );

z = feval( oper, x, y );

z = mtimes( x, y, ‘rdivide’ );

rdr=(1-2z)log(1+ytheta2/(1-2z));
++++++++++++++++++

I have tested this procedure and “rbd=zlog(1+((1-ps)PbdHbd)/noise)" is right while "rdr=(1-2z)log(1+ytheta2/(1-2z))" is wrong. I guess the problem exists in "ytheta2/(1-2*z)”. Could you please help me?

I have written as
“rdr=theta2*(-rel_entr((1-2z)/theta2,y+(1-2z)/theta2));”
Could you please tell me if it is right

If at most one of y and theta2 are CVX variables (as opposed to numerical input data), (1-2*z)*log(1+y*theta2/(1-2*z))
can be written as
-rel_entr(1-2*z,1-2*z+y*theta2)

However, if both y and theta2 are CVX variables,as you appear to intend, this would violate CVX’s rules and I believe the resulting expression would be neither convex nor concave, even if z were input data rather than being a variable.

Thanks a lot! I mean “z” and “y” are variables which I want to solve, while “theta2” is a constant. Can I rewrite (1-2*z)*log(1+y*theta2/(1-2*z)) as -rel_entr(1-2*z,1-2*z+y*theta2)? Similarly, can z*log(1+x*theta1/z) be reexpressed as “-rel_entr(z,z+x*theta1)”? Here, “z” and “x” are CVX variables, and theta1 is a constant. I am sorry to bother you, thanks for your help again.

Yes to both questions.