function [res,X1]=newPX(P,par);

T        = par(18);                   % length of time series
param    = [par(1:18+16*T);P];        % parameters
X0       = par(27+17*T:26+28*T);      % benchmark solution to focs
cparam   = par(27+28*T:length(par));  % parameters of the constraints

X1       = secant('fdifoc',X0,param);
[foc,V]  = fdifoc(X1,param);
res      = [foc;
            V-cparam];

