function [ x, w ] = rule04 ( n )

%*****************************************************************************80
%
%% RULE04 returns the rule of degree 4.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    09 July 2014
%
%  Author:
%
%    Original FORTRAN77 version by Hong Xiao, Zydrunas Gimbutas.
%    This MATLAB version by John Burkardt.
%
%  Reference:
%
%    Hong Xiao, Zydrunas Gimbutas,
%    A numerical algorithm for the construction of efficient quadrature
%    rules in two and higher dimensions,
%    Computers and Mathematics with Applications,
%    Volume 59, 2010, pages 663-676.
%
%  Parameters:
%
%    Input, integer N, the number of nodes.
%
%    Output, real X(3,N), the coordinates of the nodes.
%
%    Output, real W(N), the weights.
%
  xs = [ ...
    -.1459612280979987E-01,-.2937244896309993, ...
    0.3230878337158274,-.8819654179396583E-01, ...
    0.1270203663314710,-.4414307688091184, ...
    0.3939418589633429,-.6034469714614210E-01, ...
    -.8914059834601185E-01,0.6545213033603760, ...
    -.7307642259677857 ];
  ys = [ ...
    0.2426564579199708E-02,0.1764396506764613, ...
    -.1932070410956556,0.2317884270105980E-01, ...
    0.5451410677215219,-.3848225631590180, ...
    0.2068744670639530,-.4573739074927080, ...
    0.7268092659599459,-.3970356243870571, ...
    -.2669420088648982 ];
  zs = [ ...
    0.7093565780103633,0.1108860494941134, ...
    0.1695426396704650,-.2011819391325586, ...
    0.1309503990759315,0.9225429679162532E-01, ...
    -.3111560426198242,-.3302215329322376, ...
    -.3507931737363739,-.2970424833951137, ...
    -.3861037570241846 ];
  ws = [ ...
    0.1033787090646894,0.1070356256090164, ...
    0.1504792582740940,0.1877987156186583, ...
    0.7395274312521298E-01,0.7712199925411270E-01, ...
    0.6745419368701999E-01,0.5819413648173244E-01, ...
    0.5378646711152148E-01,0.5366953183949744E-01, ...
    0.3811216334909158E-01 ];

  x(1,1:n) = xs(1:n);
  x(2,1:n) = ys(1:n);
  x(3,1:n) = zs(1:n);
  w(1:n) = ws(1:n);

  return
end
