function dydx = f(x,y,region)

global n eta lambda kappa

   dydx = zeros(2,1);
   dydx(1) = (y(2) - 1)/n;

   % The definition of C'(x) depends on the region.
   switch region
      case 1                                % x in [0 1]
         dydx(2) = (y(1)*y(2) - x)/eta; 
      case 2                                % x in [1 lambda]
         dydx(2) = (y(1)*y(2) - 1)/eta;
    end
end                % End nested function f