# My function is concave: Cannot perform the operation: {real affine} .* {convex}

Hello,

I would like to maximize:

``````H(P1,P2)=(R1+R2)-alpha*(P1+P2+Pc) where:
* R1=log(1+(G1*P1)*inv_pos(G1*P2+1))/log2;
* R2=log(1+G2*P2)/log(2);
``````

The variables are: P1,P2. I’ve proved that my function is concave.

the code is:

``````cvx_begin
variables P1 P2 ;
dual variables y1 y2 y3
R1=log(1+(G1*P1)*inv_pos(G1*P2+1))/log2;
R2=log(1+G2*P2)/log(2);
H=(R1+R2)-alpha*(P1+P2+Pc);
maximize( H )
subject to
y1 : (P1+P2)<=Pmax;
y2 : P1>=A1*(P2+1/G1);
y3 : P2>=A2/G2;
cvx_end
``````

But when I run my script I get this error:

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

Error in * (line 36)
z = feval( oper, x, y );

Error in equality_constr_norm_min (line 24)
R1=log(1+(G1*P1)inv_pos(G1P2+1))/log2;

I evaluated the Hessian of `log(1+x/(y+1))` at `x = y = 1`, and it has one positive and one negative eigenvalue. hence, that function is nether convex nor concave, so can’t be used in CVX.
Is this function indeed a simplified version of your `R1` ?strong text