# Simple Convex Optimization

``````C_1 = 0.5; C_2 = 0.8; C_3 = 0.4; C_5 = 0.3;

cvx_begin
variable A
minimize( (C_1.*(1 - A)).*(2.^(C_2./(1 - A)) - 1) + (C_3.*A).*(2.^(C_4./A) - 1))
subject to
0 < A < 1;
cvx_end
``````

I have the above convex optimization problem but the following error appears.

Error using .* (line 173)
Disciplined convex programming error:
Cannot perform the operation: {positive constant} ./ {real affine}

Error in ./ (line 19)
z = times( x, y, ‘./’ );

I tried to fix it after reading the division rule but still cannot figure out what is wrong

Perhaps it’s not quite as simple as you imply.

You will need to use 2 separate exponential cone constraints.

Expression of the form
`y*exp(x/y)` , with y > 0, will need to be replaced by a new variable `z` and the constraint
{x,y,z} == exponential(1)

You will need this to be `z1` for the expression involving `1-A`, in which `1-A` will be the `y`. And `z2` for the expression involving `A`, for which `A` will be the `y`. You will need to convert `2^(b/c)` to `exp(b*log(2)/c)`before doing this.

I will let you work through the details so that you learn something.

1 Like

Thanks so much for your help.