function w = twb_rule_w ( strength )

%*****************************************************************************80
%
%% twb_rule_w returns the weight of a TWB rule of given strength.
%
%  Discussion:
%
%    The weights are normalized so that they sum to 1/2, the area of the
%    triangle (0,0) -- (1,0) -- (1,0).
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    16 April 2019
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Mark Taylor, Beth Wingate, Len Bos, 
%    Several new quadrature formulas for polynomial integration in the triangle, 
%    http://arxiv.org/abs/math/0501496v2,
%    08 February 2007.
%
%  Parameters:
%
%    Input, integer STRENGTH, the desired strength.
%    1 <= STRENGTH.
%
%    Output, real W(N), the weight of the rule, if it exists.
%
  n = twb_rule_n ( strength );

  if ( n < 1 )
    w = [];
    return
  end

  if ( strength == 1 )
    w = [ ...
    2.0 ];
  elseif ( strength == 2 )
    w = [ ...
    0.6666666666667; ...
    0.6666666666667; ...
    0.6666666666667 ];
  elseif ( strength == 4 )
    w = [ ...
    0.2199034873106; ...
    0.2199034873106; ...
    0.2199034873106; ...
    0.4467631793560; ...
    0.4467631793560; ...
    0.4467631793560 ];
  elseif ( strength == 5 )
    w = [ ...
    0.0262712099504; ...
    0.0262716612068; ...
    0.0274163947600; ...
    0.2348383865823; ...
    0.2348412238268; ...
    0.2480251793114; ...
    0.2480304922521; ...
    0.2518604605529; ...
    0.2518660533658; ...
    0.4505789381914 ];
  elseif ( strength == 7 )
    w = [ ...
    0.0102558174092; ...
    0.0102558174092; ...
    0.0102558174092; ...
    0.1116047046647; ...
    0.1116047046647; ...
    0.1116047046647; ...
    0.1116047046647; ...
    0.1116047046647; ...
    0.1116047046647; ...
    0.1679775595335; ...
    0.1679775595335; ...
    0.1679775595335; ...
    0.2652238803946; ...
    0.2652238803946; ...
    0.2652238803946 ];
  elseif ( strength == 9 )
    w = [ ...
    0.0519871420646; ...
    0.0519871420646; ...
    0.0519871420646; ...
    0.0707034101784; ...
    0.0707034101784; ...
    0.0707034101784; ...
    0.0707034101784; ...
    0.0707034101784; ...
    0.0707034101784; ...
    0.0909390760952; ...
    0.0909390760952; ...
    0.0909390760952; ...
    0.0909390760952; ...
    0.0909390760952; ...
    0.0909390760952; ...
    0.1032344051380; ...
    0.1032344051380; ...
    0.1032344051380; ...
    0.1881601469167; ...
    0.1881601469167; ...
    0.1881601469167 ];
  elseif ( strength == 11 )
    w = [ ...
    0.0114082494033; ...
    0.0114082494033; ...
    0.0132691285720; ...
    0.0132691285720; ...
    0.0155865773350; ...
    0.0408274780428; ...
    0.0408274780429; ...
    0.0579849665116; ...
    0.0579849665116; ...
    0.0601385247663; ...
    0.0601385247663; ...
    0.0625273888433; ...
    0.0625273888433; ...
    0.0639684321504; ...
    0.0639684321504; ...
    0.0661325872161; ...
    0.0668503236820; ...
    0.0668503236821; ...
    0.0686904305977; ...
    0.0686904305977; ...
    0.1002717543859; ...
    0.1143136784099; ...
    0.1143136784099; ...
    0.1223648146752; ...
    0.1223648146752; ...
    0.1394422334178; ...
    0.1394422334178; ...
    0.1744377829182 ];
  elseif ( strength == 13 )
    w = [ ...
    0.0166240998757; ...
    0.0166811699778; ...
    0.0166830569067; ...
    0.0175680870083; ...
    0.0184474661845; ...
    0.0197942410188; ...
    0.0203540395855; ...
    0.0206852863940; ...
    0.0208271366086; ...
    0.0317819778279; ...
    0.0320472035241; ...
    0.0320607681146; ...
    0.0430765959183; ...
    0.0438473415339; ...
    0.0439209672733; ...
    0.0479951923691; ...
    0.0483806260733; ...
    0.0484867423375; ...
    0.0556964488024; ...
    0.0561026364356; ...
    0.0565190123693; ...
    0.0689289890670; ...
    0.0717213336089; ...
    0.0727453920976; ...
    0.0788807336737; ...
    0.0810114345512; ...
    0.0825725299055; ...
    0.0842044567330; ...
    0.0843585533305; ...
    0.0851969868488; ...
    0.0902845328052; ...
    0.0914283143485; ...
    0.0916279065409; ...
    0.1025573374896; ...
    0.1033159661413; ...
    0.1035854367193 ];
  elseif ( strength == 14 )
    w = [ ...
    0.0010616711990; ...
    0.0010616711990; ...
    0.0010616711990; ...
    0.0131460236101; ...
    0.0131460236101; ...
    0.0131460236101; ...
    0.0131460236101; ...
    0.0131460236101; ...
    0.0131460236101; ...
    0.0242881926949; ...
    0.0242881926949; ...
    0.0242881926949; ...
    0.0242881926949; ...
    0.0242881926949; ...
    0.0242881926949; ...
    0.0316799866332; ...
    0.0316799866332; ...
    0.0316799866332; ...
    0.0316799866332; ...
    0.0316799866332; ...
    0.0316799866332; ...
    0.0349317947036; ...
    0.0349317947036; ...
    0.0349317947036; ...
    0.0383664533945; ...
    0.0383664533945; ...
    0.0383664533945; ...
    0.0578369491210; ...
    0.0578369491210; ...
    0.0578369491210; ...
    0.0578369491210; ...
    0.0578369491210; ...
    0.0578369491210; ...
    0.0725821687394; ...
    0.0725821687394; ...
    0.0725821687394; ...
    0.0725821687394; ...
    0.0725821687394; ...
    0.0725821687394; ...
    0.0897856524107; ...
    0.0897856524107; ...
    0.0897856524107; ...
    0.1034544533617; ...
    0.1034544533617; ...
    0.1034544533617 ];
  elseif ( strength == 16 )
    w = [ ...
    0.0006202599851; ...
    0.0006315174712; ...
    0.0007086601559; ...
    0.0055163716168; ...
    0.0062692407656; ...
    0.0078531408826; ...
    0.0094551483864; ...
    0.0097824511271; ...
    0.0099861643489; ...
    0.0137553818816; ...
    0.0140979178040; ...
    0.0149646864337; ...
    0.0156097503612; ...
    0.0157683693348; ...
    0.0175794546383; ...
    0.0204113840270; ...
    0.0209562878616; ...
    0.0210713412998; ...
    0.0217646760202; ...
    0.0222288408699; ...
    0.0224186693682; ...
    0.0230122616993; ...
    0.0236813902500; ...
    0.0257464643368; ...
    0.0257956801608; ...
    0.0258072327610; ...
    0.0260343232059; ...
    0.0265768141609; ...
    0.0265784761831; ...
    0.0267532329238; ...
    0.0375787806641; ...
    0.0383065894195; ...
    0.0384849695025; ...
    0.0389619825852; ...
    0.0394604111547; ...
    0.0412364778098; ...
    0.0512872438483; ...
    0.0516405641935; ...
    0.0518230042269; ...
    0.0528527988181; ...
    0.0538505573027; ...
    0.0541895329319; ...
    0.0584737146444; ...
    0.0592863168363; ...
    0.0594358276749; ...
    0.0631800255863; ...
    0.0632926845153; ...
    0.0640707361772; ...
    0.0812040595918; ...
    0.0814437513530; ...
    0.0814679201241; ...
    0.0815050548084; ...
    0.0815164664939; ...
    0.0816931059623; ...
    0.0923218334531 ];
  elseif ( strength == 18 )
    w = [ ...
    0.0025165756986; ...
    0.0025273452007; ...
    0.0033269295333; ...
    0.0081503492125; ...
    0.0086135525742; ...
    0.0087786746179; ...
    0.0097099585562; ...
    0.0102466211915; ...
    0.0108397688341; ...
    0.0129385390176; ...
    0.0136339823583; ...
    0.0138477328147; ...
    0.0139421540105; ...
    0.0144121399968; ...
    0.0153703455534; ...
    0.0162489802253; ...
    0.0169718304280; ...
    0.0170088532421; ...
    0.0170953520675; ...
    0.0173888854559; ...
    0.0174543962439; ...
    0.0178406757287; ...
    0.0178446863879; ...
    0.0179046337552; ...
    0.0181259756201; ...
    0.0184784838882; ...
    0.0185793564371; ...
    0.0203217151777; ...
    0.0213771661809; ...
    0.0231916854098; ...
    0.0274426710859; ...
    0.0290301922340; ...
    0.0294522738505; ...
    0.0299436251629; ...
    0.0307026948119; ...
    0.0325263365863; ...
    0.0327884208506; ...
    0.0331234675192; ...
    0.0346167526875; ...
    0.0347081373976; ...
    0.0347372049404; ...
    0.0348528762454; ...
    0.0348601561186; ...
    0.0355471569975; ...
    0.0360182996383; ...
    0.0362926285843; ...
    0.0381897702083; ...
    0.0392252800118; ...
    0.0482710125888; ...
    0.0489912121566; ...
    0.0497220833872; ...
    0.0507065736986; ...
    0.0509771994043; ...
    0.0521360063667; ...
    0.0523460874925; ...
    0.0524440683552; ...
    0.0527459644823; ...
    0.0529449063728; ...
    0.0542395594501; ...
    0.0543470203419; ...
    0.0547100548639; ...
    0.0557288345913; ...
    0.0577734264233; ...
    0.0585393781623; ...
    0.0609039250680; ...
    0.0637273964449 ];
  elseif ( strength == 20 )
    w = [ ...
    0.0021744545399; ...
    0.0028987135265; ...
    0.0030846029337; ...
    0.0034401633104; ...
    0.0041898472012; ...
    0.0044738051498; ...
    0.0047054420814; ...
    0.0048867935750; ...
    0.0051927643369; ...
    0.0074073058981; ...
    0.0079755410301; ...
    0.0083550522910; ...
    0.0096166660864; ...
    0.0096318257850; ...
    0.0098577460758; ...
    0.0102657880301; ...
    0.0103188103111; ...
    0.0106291001630; ...
    0.0106881306895; ...
    0.0106969021010; ...
    0.0109026461714; ...
    0.0109899783575; ...
    0.0113423055229; ...
    0.0120535642930; ...
    0.0139619193821; ...
    0.0141147991536; ...
    0.0141930347046; ...
    0.0144212676268; ...
    0.0144704346855; ...
    0.0144949769872; ...
    0.0145386775694; ...
    0.0145964190926; ...
    0.0147314578466; ...
    0.0167463963304; ...
    0.0168955500458; ...
    0.0169422662884; ...
    0.0173070172095; ...
    0.0174524546493; ...
    0.0177217222159; ...
    0.0282824024023; ...
    0.0284996712488; ...
    0.0285005646539; ...
    0.0300647223478; ...
    0.0302031277082; ...
    0.0303987136077; ...
    0.0305668796074; ...
    0.0306067413002; ...
    0.0309330068201; ...
    0.0309773820835; ...
    0.0313146250545; ...
    0.0313573493392; ...
    0.0314320469287; ...
    0.0315182143894; ...
    0.0324248137985; ...
    0.0347512152386; ...
    0.0350393454927; ...
    0.0350717420310; ...
    0.0352129215334; ...
    0.0352615504981; ...
    0.0366403220343; ...
    0.0367733107670; ...
    0.0371675662937; ...
    0.0373371571606; ...
    0.0403973346588; ...
    0.0413580040638; ...
    0.0421957791870; ...
    0.0495451004037; ...
    0.0500419261141; ...
    0.0505794587115; ...
    0.0520037210188; ...
    0.0521533567886; ...
    0.0524899152358; ...
    0.0599159762516; ...
    0.0599609997426; ...
    0.0599915272129; ...
    0.0634133183449; ...
    0.0635311861108; ...
    0.0637206605672 ];
  elseif ( strength == 21 )
    w = [ ...
    0.0006704436439; ...
    0.0006704436439; ...
    0.0006704436439; ...
    0.0045472608074; ...
    0.0045472608074; ...
    0.0045472608074; ...
    0.0045472608074; ...
    0.0045472608074; ...
    0.0045472608074; ...
    0.0052077585320; ...
    0.0052077585320; ...
    0.0052077585320; ...
    0.0052077585320; ...
    0.0052077585320; ...
    0.0052077585320; ...
    0.0065435432887; ...
    0.0065435432887; ...
    0.0065435432887; ...
    0.0092737841533; ...
    0.0092737841533; ...
    0.0092737841533; ...
    0.0092737841533; ...
    0.0092737841533; ...
    0.0092737841533; ...
    0.0095937782623; ...
    0.0095937782623; ...
    0.0095937782623; ...
    0.0095937782623; ...
    0.0095937782623; ...
    0.0095937782623; ...
    0.0114247809167; ...
    0.0114247809167; ...
    0.0114247809167; ...
    0.0114247809167; ...
    0.0114247809167; ...
    0.0114247809167; ...
    0.0117216964174; ...
    0.0117216964174; ...
    0.0117216964174; ...
    0.0117216964174; ...
    0.0117216964174; ...
    0.0117216964174; ...
    0.0188197155232; ...
    0.0188197155232; ...
    0.0188197155232; ...
    0.0188197155232; ...
    0.0188197155232; ...
    0.0188197155232; ...
    0.0235260980271; ...
    0.0235260980271; ...
    0.0235260980271; ...
    0.0235571466151; ...
    0.0235571466151; ...
    0.0235571466151; ...
    0.0268246207430; ...
    0.0268246207430; ...
    0.0268246207430; ...
    0.0268246207430; ...
    0.0268246207430; ...
    0.0268246207430; ...
    0.0314289776779; ...
    0.0314289776779; ...
    0.0314289776779; ...
    0.0314289776779; ...
    0.0314289776779; ...
    0.0314289776779; ...
    0.0337196192159; ...
    0.0337196192159; ...
    0.0337196192159; ...
    0.0337196192159; ...
    0.0337196192159; ...
    0.0337196192159; ...
    0.0427745294213; ...
    0.0427745294213; ...
    0.0427745294213; ...
    0.0427745294213; ...
    0.0427745294213; ...
    0.0427745294213; ...
    0.0441138932737; ...
    0.0441138932737; ...
    0.0441138932737; ...
    0.0461469594684; ...
    0.0461469594684; ...
    0.0461469594684; ...
    0.0461469594684; ...
    0.0461469594684; ...
    0.0461469594684; ...
    0.0469152468624; ...
    0.0469152468624; ...
    0.0469152468624; ...
    0.0551199980347 ];
  elseif ( strength == 23 )
    w = [ ...
    0.0006438298261; ...
    0.0006438413076; ...
    0.0010134735710; ...
    0.0010134752576; ...
    0.0019679929935; ...
    0.0033467313784; ...
    0.0033467339208; ...
    0.0042873323375; ...
    0.0042873459885; ...
    0.0043003801372; ...
    0.0043003849098; ...
    0.0056934629205; ...
    0.0056934640134; ...
    0.0061643868015; ...
    0.0061644756418; ...
    0.0062014513591; ...
    0.0062014531952; ...
    0.0069636330294; ...
    0.0069636331842; ...
    0.0075066257720; ...
    0.0075066264565; ...
    0.0079074768339; ...
    0.0079074772485; ...
    0.0080353344623; ...
    0.0087963441074; ...
    0.0087963448112; ...
    0.0091304195716; ...
    0.0091304213611; ...
    0.0092821748751; ...
    0.0092821815662; ...
    0.0094499806178; ...
    0.0094627468484; ...
    0.0094627485294; ...
    0.0095555772285; ...
    0.0095555792843; ...
    0.0096138842488; ...
    0.0096138846826; ...
    0.0099991524212; ...
    0.0099991551850; ...
    0.0100301319277; ...
    0.0100301346636; ...
    0.0124936676185; ...
    0.0124936726125; ...
    0.0140197309137; ...
    0.0143336216896; ...
    0.0143336272125; ...
    0.0153604142740; ...
    0.0153604183425; ...
    0.0184523825614; ...
    0.0184523863146; ...
    0.0195833983573; ...
    0.0195834019994; ...
    0.0197632751342; ...
    0.0197632766677; ...
    0.0198806391019; ...
    0.0198806485776; ...
    0.0207181838484; ...
    0.0207181934893; ...
    0.0208943071440; ...
    0.0208943251956; ...
    0.0214864573885; ...
    0.0214864586007; ...
    0.0222218133036; ...
    0.0222218160203; ...
    0.0223345305455; ...
    0.0223345378739; ...
    0.0224758924946; ...
    0.0224758980440; ...
    0.0229701395845; ...
    0.0229703394438; ...
    0.0232798376102; ...
    0.0232798427506; ...
    0.0269483199647; ...
    0.0269483307107; ...
    0.0280438758010; ...
    0.0280438764607; ...
    0.0287526270172; ...
    0.0287526387271; ...
    0.0298980829063; ...
    0.0298980922759; ...
    0.0309004358516; ...
    0.0309004385956; ...
    0.0314031017088; ...
    0.0314031073955; ...
    0.0319191553024; ...
    0.0319191668378; ...
    0.0321429924062; ...
    0.0330395601388; ...
    0.0330395631829; ...
    0.0356169095589; ...
    0.0356169276054; ...
    0.0365741189998; ...
    0.0365741515204; ...
    0.0365977646990; ...
    0.0365978053889; ...
    0.0369945680114; ...
    0.0369945775059; ...
    0.0374053623787; ...
    0.0375550258317; ...
    0.0375550312530; ...
    0.0388887693486; ...
    0.0388887708342; ...
    0.0392705643548; ...
    0.0392705802517; ...
    0.0398766879831 ];
  elseif ( strength == 25 )
    w = [ ...
    0.0014873417859; ...
    0.0014889035262; ...
    0.0015005944380; ...
    0.0015059208313; ...
    0.0015318868715; ...
    0.0023032634487; ...
    0.0023649067042; ...
    0.0028751143611; ...
    0.0029862488735; ...
    0.0030384162737; ...
    0.0032092459688; ...
    0.0037029598435; ...
    0.0037407186035; ...
    0.0038452543223; ...
    0.0038670778668; ...
    0.0039192555178; ...
    0.0039573282688; ...
    0.0044032251724; ...
    0.0045907108173; ...
    0.0047023669435; ...
    0.0050014843818; ...
    0.0052387830156; ...
    0.0054422104092; ...
    0.0056931248912; ...
    0.0059107422989; ...
    0.0059687967687; ...
    0.0067262190287; ...
    0.0068307848624; ...
    0.0069531259112; ...
    0.0072460270642; ...
    0.0072728189613; ...
    0.0073008930847; ...
    0.0073604666776; ...
    0.0074119923255; ...
    0.0074892214336; ...
    0.0078604067260; ...
    0.0078621726423; ...
    0.0080506361066; ...
    0.0081442860473; ...
    0.0081478804152; ...
    0.0092444146612; ...
    0.0094674635165; ...
    0.0097132210137; ...
    0.0099753581151; ...
    0.0103367803673; ...
    0.0112263277166; ...
    0.0114309118745; ...
    0.0115550567487; ...
    0.0135575856957; ...
    0.0135984962900; ...
    0.0137754813837; ...
    0.0137961015942; ...
    0.0138408839904; ...
    0.0140634019977; ...
    0.0140991451009; ...
    0.0142004111991; ...
    0.0144518424517; ...
    0.0150245979639; ...
    0.0152817804122; ...
    0.0155550724169; ...
    0.0164570886000; ...
    0.0165275759573; ...
    0.0166847554451; ...
    0.0167409312985; ...
    0.0168674663361; ...
    0.0168882230165; ...
    0.0172087112691; ...
    0.0174681068264; ...
    0.0176663899614; ...
    0.0182967621475; ...
    0.0183576852459; ...
    0.0186392569521; ...
    0.0189781060590; ...
    0.0191847922578; ...
    0.0194080442044; ...
    0.0194720072193; ...
    0.0200855080495; ...
    0.0201673909332; ...
    0.0221742162761; ...
    0.0229702440508; ...
    0.0233465117399; ...
    0.0234883135338; ...
    0.0240682099018; ...
    0.0240910792953; ...
    0.0245677049481; ...
    0.0246536315719; ...
    0.0246756530052; ...
    0.0249704602710; ...
    0.0250026544082; ...
    0.0250490869426; ...
    0.0250936250125; ...
    0.0251482076226; ...
    0.0255010290447; ...
    0.0256544511979; ...
    0.0257974750630; ...
    0.0270007753993; ...
    0.0274431536844; ...
    0.0277072401488; ...
    0.0278284415364; ...
    0.0287207381105; ...
    0.0288826834956; ...
    0.0293302729759; ...
    0.0318902879557; ...
    0.0319083660286; ...
    0.0320938960329; ...
    0.0321618608780; ...
    0.0322424127534; ...
    0.0327072446421; ...
    0.0329946316695; ...
    0.0331828096025; ...
    0.0334857162651; ...
    0.0335468472792; ...
    0.0337049042988; ...
    0.0340361462767; ...
    0.0342465235323; ...
    0.0345528817251; ...
    0.0356782875703; ...
    0.0364656225016; ...
    0.0365172708706; ...
    0.0371924811018 ];
  end

  w = w / 4.0;

  return
end
