# Illegal operation: log( {convex} )

here is the error constraint, how to rewirte this constrain in a proper form.
cvx_begin
variable delta(M,1)
subject to
for m=1:M
R2(m,k)=log(1+1.*pow_p((pow_p(delta(m,1),2)),-1))/log(2)>=0;
end
cvx_end

`log(1+1.*pow_p((pow_p(delta(m,1),2)),-1))/log(2)`
doesn’t follow CVX’s DCP rules. But in any event, it s convex, and therefore constraining it to be >= 0 is a non-convex constraint.

If the log were removed, which makes the LHS a “legal” convex expression, constraining that to be >= 1 would still be a non-convex constraint.

Thank you for your guidance. I will deal with it in a different way.

M=4;
K=10;
I=M+1;
cvx_begin
variables eta delta(M,1) xi(M,1)
expressions R1(M,K) R2(I,M) R3(M,K) R4(M,M)
maximize(eta)
subject to
%% first constraint
for m=1:M
for k=1:K
R1(m,k)=-(delta(m,1).^2+xi(m,1).^2)-delta(m,1)-xi(m,1);
end
sum(R1(m,:)) >= eta;
end
%% second constraint
for m=1:M
for i=1:I
R2(i,m)=-(square(delta(m,1))+square(xi(m,1)))-delta(m,1)-xi(m,1);
end
for k=1:K
R3(m,k)=log(pow_p((1+2*delta(m,1)+2.*xi(m,1)),-1))/log(2); % illegal operation here
end
for j=1:M
R4(m,j)=log(pow_p((1+2.*delta(m,1)+2.*xi(m,1)),-1))/log(2); % illegal operation here
end
sum(R2(:,m))>=sum(R3(m,:))+sum(R4(m,:));
end
cvx_end

You have multiple violations of CVX’s rules. If you ever got some version of R3 and R4 to be accepted, the final constraint would still violate CVVX’s rules. This model looks non-convex to me, although I have not completely ruled out that is may somehow net out to be convex.

If you don’t have a convex model, there is no hope of getting it accepted by CVX. Even if you do have a convex model, I;m not sure expressions such as R3 and R4 can be formulated in a way acceptable to CVX.

I must insist that you not repeatedly post about effectively the same issue. Indeed, I would suggest that CVX is not appropriate for the kind of models you are solving.

cvx_begin
variable t
maximize ( log(t^2) )
subject to
t>=K;
t<=T;
cvx_end

Error using cvx/log (line 64)
Disciplined convex programming error:
Illegal operation: log( {convex} ).

log is concave function and concave with convex variable still concave! but i got above error

" concave with convex variable still concave!" is not true.

In this case of course you can just write `2*log(t)`