# Can't perform the operation: {positive constant} ./ {real affine}

Why can’t the function “log(1+Pr_m.*gama_0./x)” be recognized by CVX. Pr_m and gama_0 are positive constant. It’s a convex function of x .

maybe you’d better use the function inv_pos,use command help inv_pos get more details about it

1 Like

If you look under entropy at

you can see how to reformulate to something Cvx understand.

I use the function inv_pos,but an error : Illegal operation: log( {convex} ).
cvx_begin
variables Tau_Q Phi(K,N) de_hat(1,N)
for k=1:K
sum(alpha_A(k,:).*(Phi(k,：) - log(1+inv_pos(de_hat).*Pr_m.gama_0)./log(2))) >= NTau_Q ;
end
cvx_end
where alpha_A(K,N) , Pr_m(1,N) , gama_0 are constant
The results showed：Illegal operation: log( {convex} )
I hope you can help me. Thank you very much

there have two ways
1:use slack variable ,define t=1/x,then add constrain t>=1/x;
2:Please refer to:Minimize log(1+1/x) where 0<x<inf
pleas read it carefully.

Thank you very much for your answer. I will read it carefully