In general there is nothing different with nonlinear models in TomSym. They are modeled just like a linear or quadratic problem. The modeling engine takes care of the rest, including first and second order derivatives and problem sparsity patterns.

toms x1 x2

alpha = 100;

% Objective function

f = alpha*(x2-x1^2)^2 + (1-x1)^2;

% Constraints

c = -x1^2 - x2;

con = {

-1000 <= c <= 0

-10 <= x1 <= 2

-10 <= x2 <= 2

};

% Initial conditions

x0 = {

x1 == -1.2

x2 == 1

};

% Compile and solve problem

options = struct;

options.name = 'Rosenbrocks banana';

solution = ezsolve(f,con,x0,options);