# Calculate maximize (lambda_min)

hi
I don’t know, when I use maximize (lambda_min§) for my code I receive wrong answer .

``````cvx_begin
variables P(2,2) y(2,1);
maximize(lambda_min( P ));
subject to
[A*P+P*A'+b*y'+y*b'+ep*D*P*D' y;y' -ep]<0;
-P<0;
cvx_end``````

It appears that the two inequalities are meant as SDP constraints. As written, per CVX’s syntax, they are treated as element-wise constraints. Please read http://cvxr.com/cvx/doc/sdp.html .

The simplest fix is to use sdp mode, i.e.,`cvx_begin sdp`. Also, I believe you need to declare `P` as being symmetric. Either that, or just declare it semidefinite and omit the second constraint.

Note that the strict inequalities (SDP constraints) are treated by CVX and the solvers it calls, as being non-strict.I don’t believe this will affect the second constraint, because the objective is to maximize `lambda_min(P)`, so the solver will try to make `P` strictly positive definite if possible. I am not sure whether the first constraint will be affected; if you want to make sure that that constraint is strictly satisfied, you could change it to
`[A*P+P*A'+b*y'+y*b'+ep*D*P*D' y;y' -ep] + small_positive_number <= 0`, where `small_positive_number` might be a number such as 1e-6 or 1e-5.

thanks a lot .I found my mistake