# Why can't CVX solve my problem and I am getting this error?

I am trying to to solve this problem, and when I input this code I get this error:
cvx_begin
variables x(3)
minimize (x(1)^2 + 2x(1)x(2) + 2x(2)^2 + x(3)^2 + 3x(1) - 4x(2))
subject to
sqrt(2
x(1)^2 + x(1)x(2) + 4x(2)^2 + 4) + (x(1)-x(2)+x(3)+1)^2/(x(1)+x(2)) <= 6
x >= 1
cvx_end

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

Error in minimize (line 14)
x = evalin( ‘caller’, sprintf( '%s ', varargin{:} ) );

Error in CVX_HW (line 3)
minimize x(1)^2 + 2x(1)x(2) + 2x(2)^2 +x(3)^2 +3x(1)-4*x(2)

The first things you need to do are read the CVX Users’ Guide and Why isn't CVX accepting my model? READ THIS FIRST! o learn the proper way to use CVX.

The error message you received s non-informative of the error. You need to use a PSD quadratic form rather than directly entering variable product terms. The objective function could be entered as
`x(1:2)'*[1 1;1 2]*x(1:2) + x(3)^2 + 3*x(1) - 4*x(2)`
although there are other ways which would also work.

The square root term needs to be be expressed as a norm. I’ll let you work out the details so that you learn something and do your own school assignments. The last term on the LHS of that constraint can be handled using `quad_over_lin`.

Given your homework assignment, you should not rush to make another post, as it might take you a while.

1 Like

Ok, thanks for the information.