# Error debugging formula in maximize

``````P(1)=3.1187
P(2)=1.9238
A=5
B=8
h(1)=normrnd(0,1);
h(2)=normrnd(0,1);
d(3)=500*sqrt(2)*rand(1);
d(4)=500*sqrt(2)*rand(1);
cvx_begin
variables q
maximize(1500*(1+q).*(1/10*log2((1+q)./q)+1/(log2(A*(h(1)^2)+((d(3)/d(4))^2.5)*(B*(h(1)^2)+(d(4)^2.5)*4*10000*64))-log2(P(2)*(h(2)^2)+(d(4)^2.5)*4*10000*64)-(((h(2)^2)*(B-P(2)))/((P(2)*(h(2)^2)+(d(4)^2.5)*4*10000*64)*log(2)))-2.5*log2(d(3)/d(4)))))
subject to
q>=0;
cvx_end
q
``````

As @Michal_Adamaszek has shown in Writing x*log(1+x/y)

`x*log(1+x/y) = rel_entr(x+y,y)+rel_entr(y,x+y)` with x > 0, y > 0.

I haven’t looked at your objective function carefully enough to see the scope of all the parentheses, but I think you might be able to put it in this form. You better hope that is not the case, because that expression would be convex, which you can’;t maximize in CVX. That is, unless to get it in this form, you divide by something negative, which would make the objective function concave, which could be maximized in CVX.

Have you proven the objective function is concave?