function y=f(x)

global pH

%-------------------
% PCP      -> x(1)
% H        -> x(2)
% HPCP(aq) -> x(3)
% Na       -> x(4)
% NaPCP    -> x(5)
% HPCP(okt)-> x(6)
%-------------------

KA = 10^-4.9;
K1 = 10^1;
K2 = 10^5.04;
%pH = 8;
Na = 0.15;
NaPCP = 1e-5;

y = zeros(size(x));

y(1) = KA*x(3) - x(1)*x(2);
y(2) = K1*x(5) - x(4)*x(1);
y(3) = K2*x(3) - x(6);
y(4) = x(2) - 10^-pH;
y(5) = x(4) - Na;
y(6) = NaPCP - x(5) - x(1) - x(6) - x(3);

