function [ x, w ] = rule12 ( n )

%*****************************************************************************80
%
%% RULE12 returns the rule of degree 12.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    08 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 = [ ...
    -0.7715535323463264E+00, 0.3118087350366243E-01, ...
    0.7202332131024749E+00, 0.4477007231810433E+00, ...
    0.4990977036666501E+00, 0.7276854447788592E+00, ...
    0.5641552377783545E-01, -0.6804449077772355E+00, ...
    -0.3147755705468945E-01, 0.9656886599696646E+00, ...
    -0.5809498997793892E+00, -0.2289254671435773E+00, ...
    0.7876771526454306E+00, -0.4068670890700770E+00, ...
    -0.8972365649862598E+00, -0.3532895192280955E+00, ...
    -0.9567571227498393E+00, -0.1216832508787129E+00, ...
    0.5700762717211539E+00, 0.5051003810086915E+00, ...
    0.9701289189066667E+00, -0.8467694257635688E+00, ...
    -0.9792766700328013E+00, 0.9239050051895750E+00, ...
    0.3182661293383706E+00, 0.2128643425667921E+00, ...
    -0.9491244031998681E+00, 0.7992362723313403E+00, ...
    -0.2460884124375043E+00, 0.1342871260315162E+00, ...
    -0.2373280028547328E+00, -0.5865009282285342E+00, ...
    0.4626440026822248E+00, 0.3297957744728636E+00, ...
    -0.9420531528791128E+00, -0.4341804961950992E+00, ...
    -0.9225452596590470E+00, 0.6871688089857060E+00, ...
    0.2448760905505635E+00, 0.5741688284173365E+00, ...
    -0.8594595285871465E+00, -0.5554936117139078E+00, ...
    -0.6494964119774425E+00, 0.5732782989920666E+00, ...
    0.3752071332901741E-02, 0.6435232718547543E+00, ...
    0.8238997691962470E+00, 0.6248144351825363E-01, ...
    -0.5415679713524282E+00, -0.6912095128076139E-01, ...
    0.4168395206084785E+00, 0.7671340542346751E+00, ...
    0.9499134274201164E+00, 0.6612862602874549E+00, ...
    0.4988292488539028E+00, -0.3980774278492163E+00, ...
    0.2143015046710522E+00, -0.8245870486521025E+00, ...
    0.9547288142651947E+00, -0.8256353544128002E+00, ...
    0.8043198685414620E+00, -0.6534154451891698E+00, ...
    -0.9452902258113793E+00, -0.6217330929720845E+00, ...
    -0.9665133496506871E+00, 0.1521701688630693E+00, ...
    -0.9371839994014188E+00, 0.9495343847338622E+00, ...
    -0.3463029817783037E+00, -0.7895101820283607E+00, ...
    -0.8159632548392504E-01, 0.2855115686118832E+00, ...
    0.9535458359476985E+00, -0.2998645589788054E+00, ...
    0.8771573781780831E+00, 0.5455017995441601E+00, ...
    0.9166715004534769E-01, 0.9320968927813329E+00, ...
    -0.4371224793112961E+00, -0.8347365350568826E+00, ...
    -0.6455342940659587E+00, 0.8555205523715417E+00, ...
    -0.2072617599943643E+00, -0.2113416898671757E+00, ...
    -0.9486945106212309E+00, -0.9718805025138264E+00, ...
    -0.1940500299791751E-02, 0.8641147432354730E+00, ...
    -0.7571701781562347E+00, 0.4947987121201377E+00, ...
    0.2223337905054378E+00, 0.9496122896148295E+00, ...
    0.8640108234726359E+00, 0.7680642862414261E+00, ...
    0.4625223529706101E+00, 0.9726683521171305E+00, ...
    -0.7964752179472936E+00, -0.7061109658827748E+00, ...
    -0.8721608252584128E+00, -0.6991324850192889E+00, ...
    0.9831710538535281E+00, 0.3063724124769707E+00, ...
    0.9886078377543190E+00, -0.6436734499882067E+00, ...
    -0.1696864839354078E+00, -0.9581984720461905E+00, ...
    0.6404741270364127E+00, -0.9954098177933381E+00, ...
    -0.9998048311370020E+00, -0.3608374768729438E+00, ...
    -0.4193491067426698E+00, -0.2591511667594117E+00, ...
    0.5950366411277217E+00, 0.8362890578433639E+00, ...
    -0.9989746911020813E+00, 0.9819256903295290E+00 ];
  ys = [ ...
    0.3846975186938493E+00, -0.6224498777026040E+00, ...
    0.1248067846342114E+00, 0.8759502561317533E+00, ...
    0.3319258914157911E+00, -0.5633971521527585E+00, ...
    0.8534622243379885E+00, 0.9174064836961019E+00, ...
    0.6613043682070445E-01, 0.8826351471721087E+00, ...
    0.3382028556583220E+00, 0.7699804117571577E+00, ...
    -0.3555309699183173E+00, 0.5163363528866298E+00, ...
    0.9578029706408058E+00, 0.2101811715995720E+00, ...
    -0.6596351003887070E+00, 0.2923658777723023E-01, ...
    -0.2160515820663783E+00, -0.7325716420674306E+00, ...
    -0.9320850402391798E+00, 0.2535810500632735E+00, ...
    -0.3368010225765684E+00, 0.9401901116430753E+00, ...
    0.7005289547119918E-01, -0.4318126034481278E+00, ...
    -0.7540912429552113E+00, 0.7738338149718788E+00, ...
    -0.2709207207715034E+00, -0.4558191555703927E+00, ...
    -0.9010499919081281E+00, 0.5077988769546107E+00, ...
    -0.3368014224099352E+00, -0.1248384730156639E+00, ...
    -0.9290918735449377E+00, -0.7020388511680736E+00, ...
    0.8388875287519405E+00, 0.3950015262650662E+00, ...
    0.4698716842353510E+00, 0.7927540313537204E-01, ...
    -0.4958172798073285E+00, 0.9158035761509341E-01, ...
    0.6706864246998623E+00, 0.7918494529907293E+00, ...
    -0.6319475420779336E+00, 0.6495695968654632E+00, ...
    -0.9456860423718022E+00, -0.8989638999178421E+00, ...
    -0.3735186503913843E+00, 0.4704635101750327E+00, ...
    -0.8716224029261982E+00, 0.5966448338821769E+00, ...
    0.2261581260452755E-01, -0.7330157165466431E+00, ...
    -0.7471944764154522E+00, 0.9683805827306203E+00, ...
    -0.5519164542917125E+00, -0.8971331427558276E+00, ...
    -0.8173334319953630E+00, 0.8059812120592472E+00, ...
    -0.6969456308437438E+00, -0.2340344455553026E+00, ...
    -0.6410900230088896E+00, -0.7876018852914574E+00, ...
    -0.2676406878547541E+00, 0.3656010440914417E+00, ...
    0.7517669252844423E+00, 0.9299482185727768E+00, ...
    0.8095208519693138E+00, -0.9105465384851248E-01, ...
    0.5754559865383174E-01, 0.7987833771715905E+00, ...
    0.4062222029583985E+00, -0.2917475248364298E+00, ...
    0.8341598642457054E+00, 0.9565675836400581E+00, ...
    0.9495501483452489E+00, -0.5027178324567889E+00, ...
    -0.6094294091525906E+00, -0.2041586923215633E+00, ...
    0.8735321107965007E+00, 0.8176411928945507E-01, ...
    0.5798716521493317E+00, 0.9747533229160877E+00, ...
    0.4095645350870887E+00, 0.2069198533007474E+00, ...
    -0.8800808072488089E+00, -0.2586645109021137E+00, ...
    -0.6284140921870087E+00, -0.9837391845052924E+00, ...
    0.6897557755650331E+00, 0.6214627043620098E+00, ...
    -0.9147932185865665E+00, 0.9683589014439020E+00, ...
    0.9722720243469519E+00, 0.3545312716884971E+00, ...
    -0.9265634816103003E+00, 0.9823681379288890E+00, ...
    0.6027221797612410E+00, 0.1550378502770828E+00, ...
    -0.7188423853605198E+00, -0.9880539732209580E+00, ...
    -0.3538081678676123E+00, -0.9848881983673942E+00, ...
    0.9503771401811550E+00, 0.9895536743716908E+00, ...
    -0.9877214291859133E+00, 0.6282240608226360E-01, ...
    0.8687973020715331E+00, -0.9993768714765972E+00, ...
    -0.8816819132287129E+00, -0.9024706682879141E+00, ...
    0.3779679396631332E+00, -0.1517734130495604E+00, ...
    -0.9719850622545042E+00, -0.9258604067050853E+00 ];
  zs = [ ...
    -0.9149704001000553E+00, -0.5996714764210891E+00, ...
    0.7907026496157833E+00, 0.9860392703559183E+00, ...
    -0.4660715186534219E-01, -0.1393752230506733E+00, ...
    0.8674767286359658E+00, 0.5467250815629719E+00, ...
    -0.9763780125306059E+00, 0.5121364231430013E+00, ...
    -0.6798617661241456E+00, 0.6371639769399203E+00, ...
    0.2198362375814198E+00, -0.9280616749626068E+00, ...
    0.7168598119569591E+00, 0.7368659134196429E+00, ...
    -0.6061233370696343E+00, -0.7956884470646045E+00, ...
    0.6572737265408953E+00, -0.9403846902844000E+00, ...
    -0.6276502147372000E+00, 0.1269919055587806E+00, ...
    0.4130533850992282E+00, 0.9393352681302030E+00, ...
    0.8990311398428759E+00, -0.9212501242203712E+00, ...
    0.5134369934005911E+00, 0.6109131534473928E+00, ...
    -0.4181668086036411E+00, 0.5711408979823358E+00, ...
    0.1117558004736949E+00, 0.3763350218603200E+00, ...
    -0.5509292330117498E+00, -0.1436673317026735E-01, ...
    0.8947995961383289E+00, 0.5293478643731013E+00, ...
    0.9681968180532952E+00, 0.3548727821114203E+00, ...
    0.6370668273720668E+00, -0.7744664564128696E+00, ...
    -0.1174975410572717E+00, -0.2455457407049606E+00, ...
    0.8684746243106054E+00, -0.3023424151630013E+00, ...
    -0.8384309459289455E-01, 0.9285129719767410E+00, ...
    -0.1479858042465700E+00, -0.7406305201907566E+00, ...
    0.2042255456501517E+00, 0.9724059801463540E+00, ...
    -0.3537644656876312E+00, -0.6281373274195593E+00, ...
    0.4150304386610159E+00, 0.8808795896002272E+00, ...
    0.3686704712426682E+00, 0.9460942659633094E+00, ...
    0.9681464254739912E+00, 0.1328695747867607E+00, ...
    -0.9698622847731962E+00, -0.9424723737502007E+00, ...
    -0.6724135642153274E+00, -0.9637049413487057E+00, ...
    -0.9654826579439407E+00, -0.3959451854631504E+00, ...
    0.9553150406508956E+00, -0.4818859928369797E+00, ...
    0.2896997475970485E+00, -0.5366726979456555E+00, ...
    -0.6510037274971031E+00, 0.6185934968970651E+00, ...
    0.3210185330943278E+00, 0.2400288119511415E+00, ...
    0.8510838518999654E+00, 0.8754236562515145E+00, ...
    -0.9470610777853996E+00, -0.8205588369782968E+00, ...
    -0.4018976232642799E+00, 0.7751784036421725E+00, ...
    -0.8147980972514376E+00, -0.6601638637102712E+00, ...
    -0.1260885622828708E+00, -0.3084734983651212E+00, ...
    -0.8179658955267972E-01, 0.2700716241482205E+00, ...
    0.7694412333217397E+00, -0.8836683466383671E+00, ...
    0.7669737715528676E+00, -0.9137690852575695E+00, ...
    0.8605953113236016E+00, 0.8953797328026272E+00, ...
    -0.8573304152865556E+00, -0.1765576765676193E-01, ...
    0.5663399409423517E+00, 0.8216340568717669E-01, ...
    0.7178509062543948E+00, -0.8248755417862220E+00, ...
    -0.8408410046283714E+00, -0.7367428078031174E+00, ...
    -0.4590219429006754E+00, 0.9831224519425289E+00, ...
    0.1099197404645035E+00, 0.2714915831470573E+00, ...
    -0.4771292875453570E+00, 0.6410524347781664E+00, ...
    -0.9808727711140862E+00, -0.1799508573122650E+00, ...
    -0.8648319917262105E+00, -0.1821178559958520E+00, ...
    -0.7478825522596463E+00, -0.4398682537286034E+00, ...
    0.9929654026734756E+00, -0.9978596306712945E+00, ...
    -0.9997568603576099E+00, 0.9997078506812050E+00, ...
    -0.3559815310105911E+00, 0.9905772316230947E+00 ];
  ws = [ ...
    0.8171123714265456E-02, 0.2263229388891795E-01, ...
    0.1818677478454230E-01, 0.2980129445309951E-02, ...
    0.4365304132620811E-01, 0.3243988845839241E-01, ...
    0.1486444991990349E-01, 0.1409533365332470E-01, ...
    0.1188012333452950E-01, 0.6000058026819710E-02, ...
    0.3512238833735714E-01, 0.3098299265015942E-01, ...
    0.3654756930376477E-01, 0.1847118507157365E-01, ...
    0.5391012235288447E-02, 0.4074719736210774E-01, ...
    0.1096224300316088E-01, 0.4081648743391735E-01, ...
    0.4154456995823457E-01, 0.1320278412821872E-01, ...
    0.4290449708656973E-02, 0.3535406067309509E-01, ...
    0.1105110007450795E-01, 0.3228649704663156E-02, ...
    0.2983835839394490E-01, 0.2451444151701184E-01, ...
    0.1248137360474183E-01, 0.2177139751257475E-01, ...
    0.6405596175169058E-01, 0.5434653731649390E-01, ...
    0.3076101092170598E-01, 0.4899566852520795E-01, ...
    0.5225345103961254E-01, 0.7166342203347331E-01, ...
    0.3920984475787756E-02, 0.4137916341593958E-01, ...
    0.3600172354407817E-02, 0.4755213384458860E-01, ...
    0.5073623632857935E-01, 0.3944403305910345E-01, ...
    0.3387054595129749E-01, 0.6277110525242416E-01, ...
    0.2166338571221270E-01, 0.3747883688963586E-01, ...
    0.6163661481210551E-01, 0.1666526164418470E-01, ...
    0.1395113427475628E-01, 0.2347682793313850E-01, ...
    0.6306339243839931E-01, 0.1556571594055037E-01, ...
    0.3387962780929576E-01, 0.3268836056103089E-01, ...
    0.2278931777487743E-01, 0.1962500582231501E-01, ...
    0.4456347447201976E-01, 0.5576706603430151E-02, ...
    0.1594423386163151E-01, 0.2035708135880945E-01, ...
    0.3103484011599505E-02, 0.9044075785104641E-02, ...
    0.2689758906199793E-01, 0.1586801972478047E-01, ...
    0.5176595113431329E-02, 0.3858960164224838E-01, ...
    0.5739931404252700E-02, 0.7158286709420723E-01, ...
    0.1871157285391988E-01, 0.8194850948531980E-02, ...
    0.3678122219124356E-01, 0.4250046085039932E-01, ...
    0.8513849699040082E-01, 0.4993413782858739E-01, ...
    0.1233822876422000E-01, 0.3941817987846824E-01, ...
    0.7113418117354728E-02, 0.1194652514212529E-01, ...
    0.2508023865178747E-01, 0.1725533956116014E-01, ...
    0.3737010567296990E-01, 0.3668781342194600E-01, ...
    0.3343163204554410E-01, 0.4496577144136969E-01, ...
    0.7409539266110132E-01, 0.1793429116081015E-01, ...
    0.1653960634734396E-01, 0.9190332852452304E-02, ...
    0.2809796363000793E-01, 0.1777992760135489E-01, ...
    0.2391632963314971E-01, 0.5749099213189723E-02, ...
    0.3433774681484043E-01, 0.2274673898154641E-01, ...
    0.1536942439600953E-01, 0.1430939257823392E-01, ...
    0.1282919496053713E-01, 0.1121380440794668E-01, ...
    0.1184676390611188E-01, 0.7982226989051386E-02, ...
    0.3477385886958077E-01, 0.1190123605011125E-01, ...
    0.1168229078012223E-01, 0.1343804099688911E-01, ...
    0.1228891741931907E-01, 0.1036505178017157E-01, ...
    0.5937174344287885E-02, 0.4133423282546477E-02, ...
    0.6371010607497968E-02, 0.1313727761639429E-01, ...
    0.3669992824757512E-02, 0.1078959526158836E-01, ...
    0.7230671036845260E-02, 0.6406235552064114E-02, ...
    0.1096476832530329E-01, 0.7917718162474640E-02, ...
    0.3572933439799740E-02, 0.1541652661200926E-02 ];

  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
