# How to express this function?

(EHTISHAM ASGHAR) #1

f(x) = 100*(x^2 - y)^2 + (1 - x)^2

can be expressed as?
cvx_begin
variables x y;
minimize(100*square_pos(square(x)-y) + square(1-x));
cvx_end

(Mark L. Stone) #2

f(x) is the Rosenbrock function, which is non-convex. For example, at x = y = 0.98, its Hessian has one positive and one negative eigenvalue, and therefore is indefinite. Therefore, CVX will not accept this function,

That said, the program you provided is valid CVX code, and will be accepted by CVX and solved. But the objective function is not the Rosenbrock function. The use of square_pos on square(x)-y) means that square(x)-y is evaluated to zero if y > square(x). Therefore, the solution x = 1 with y any value >= 1 is optimal for this problem, even though x = y = 1 is the unique global optimum for the Rosenbrock function. The CVX solution will have optimal y >= 1, and quite possibly > 1, which solves the problem entered, but may not minimize the Rosenbrock functionâ€¦

(EHTISHAM ASGHAR) #3