% FIGURE 5.3.3b
      function GAUSS = GAUSS(F,K,I)
      global N XPTS LOCATE
%                             USE THE GAUSS 3 POINT FORMULA TO
%                             INTEGRATE F(X,K,I).
      S = [0.1127016653792583,0.5000000000000000,0.8872983346207417];
      W = [0.2777777777777778,0.4444444444444444,0.2777777777777778];
      GAUSS = 0.0;
%                             THE FUNCTION F INVOLVES PHI(K,...), WHICH
%                             IS NONZERO ONLY FROM XPTS(IK) TO
%                             XPTS(IK+2)
      [HORS,IK] = LOCATE(K);
      for J=max(IK,1):min(IK+1,N)
         H = XPTS(J+1)-XPTS(J);
         for JX=1:3
            X = XPTS(J)+S(JX)*H;
            GAUSS = GAUSS + H*W(JX)*F(X,K,I);
         end
      end
