function [ xtab, weight ] = legendre_set_x2 ( norder ) %% LEGENDRE_SET_X2 sets a Gauss-Legendre rule for ( 1 + X )**2 * F(X) on [-1,1]. % % Discussion: % % The integration interval is [ -1, 1 ]. % % The weight function is w(x) = ( 1 + x )**2. % % The integral to approximate: % % Integral ( -1 <= X <= 1 ) ( 1 + X )**2 * F(X) dX % % The quadrature rule: % % Sum ( 1 <= I <= NORDER ) WEIGHT(I) * F ( XTAB(I) ) % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 13 October 2005 % % Author: % % John Burkardt % % Reference: % % Arthur Stroud, Don Secrest, % Gaussian Quadrature Formulas, % Prentice Hall, 1966, % LC: QA299.4G3S7. % % Parameters: % % Input, integer NORDER, the order of the rule. % NORDER must be between 1 and 9. % % Output, real XTAB(NORDER), the abscissas of the rule. % % Output, real WEIGHT(NORDER), the weights of the rule. % if ( norder == 1 ) xtab(1) = 0.5; weight(1) = 2.66666666666666666666666666666; elseif ( norder == 2 ) xtab(1) = -0.0883036880224505775998524725910; xtab(2) = 0.754970354689117244266519139258; weight(1) = 0.806287056638603444666851075928; weight(2) = 1.86037961002806322199981559074; elseif ( norder == 3 ) xtab(1) = -0.410004419776996766244796955168; xtab(2) = 0.305992467923296230556472913192; xtab(3) = 0.854011951853700535688324041976; weight(1) = 0.239605624068645584091811926047; weight(2) = 1.16997015407892817602809616291; weight(3) = 1.25709088851909290654675857771; elseif ( norder == 4 ) xtab(1) = -0.591702835793545726606755921586; xtab(2) = -0.0340945902087350046811467387661; xtab(3) = 0.522798524896275389882037174551; xtab(4) = 0.902998901106005341405865485802; weight(1) = 0.0828179259993445222751812523731; weight(2) = 0.549071097383384602539010760334; weight(3) = 1.14767031839371367238662411421; weight(4) = 0.887107324890223869465850539752; elseif ( norder == 5 ) xtab(1) = -0.702108425894032836232448374820; xtab(2) = -0.268666945261773544694327777841; xtab(3) = 0.220227225868961343518209179230; xtab(4) = 0.653039358456608553790815164028; xtab(5) = 0.930842120163569816951085142737; weight(1) = 0.0329106016247920636689299329544; weight(2) = 0.256444805783695354037991444453; weight(3) = 0.713601289772720001490035944563; weight(4) = 1.00959169519929190423066348132; weight(5) = 0.654118274286167343239045863379; elseif ( norder == 6 ) xtab(1) = -0.773611232355123732602532012021; xtab(2) = -0.431362254623427837535325249187; xtab(3) = -0.0180728263295041680220798103354; xtab(4) = 0.395126163954217534500188844163; xtab(5) = 0.736872116684029732026178298518; xtab(6) = 0.948190889812665614490712786006; weight(1) = 0.0146486064549543818622276447204; weight(2) = 0.125762377479560410622810097040; weight(3) = 0.410316569036929681761034600615; weight(4) = 0.756617493988329628546336413760; weight(5) = 0.859011997894245060846045458784; weight(6) = 0.500309621812647503028212451747; elseif ( norder == 7 ) xtab(1) = -0.822366333126005527278634734418; xtab(2) = -0.547034493182875002223997992852; xtab(3) = -0.200043026557985860387937545780; xtab(4) = 0.171995710805880507163425502299; xtab(5) = 0.518891747903884926692601716998; xtab(6) = 0.793821941703901970495546427988; xtab(7) = 0.959734452453198985538996625765; weight(1) = 0.00714150426951365443207221475404; weight(2) = 0.0653034050584375560578544725498; weight(3) = 0.235377690316228918725962815880; weight(4) = 0.505171029671130381676271523850; weight(5) = 0.733870426238362032891332767175; weight(6) = 0.725590596901489156295739839779; weight(7) = 0.394212014211504966587433032679; elseif ( norder == 8 ) xtab(1) = -0.857017929919813794402037235698; xtab(2) = -0.631543407166567521509503573952; xtab(3) = -0.339104543648722903660229021109; xtab(4) = -0.0111941563689783438801237300122; xtab(5) = 0.316696017045595559454075475675; xtab(6) = 0.609049663022520165351466780939; xtab(7) = 0.834198765028697794599267293239; xtab(8) = 0.967804480896157932935972899807; weight(1) = 0.00374814227227757804631954025851; weight(2) = 0.0357961737041152639660521680263; weight(3) = 0.137974910241879862433949246199; weight(4) = 0.326515411108352185491692769217; weight(5) = 0.547577467373226177976217604887; weight(6) = 0.682278153375510121675529810121; weight(7) = 0.614544746137780998436053880546; weight(8) = 0.318231662453524478640851647411; elseif ( norder == 9 ) xtab(1) = -0.882491728426548422828684254270; xtab(2) = -0.694873684026474640346360850039; xtab(3) = -0.446537143480670863635920316400; xtab(4) = -0.159388112702326252531544826624; xtab(5) = 0.141092709224374414981503995427; xtab(6) = 0.428217823321559204544020866175; xtab(7) = 0.676480966471850715860378175342; xtab(8) = 0.863830940812464825046988286026; xtab(9) = 0.973668228805771018909618924364; weight(1) = 0.00209009877215570354392734918986; weight(2) = 0.0205951891648697848186537272448; weight(3) = 0.0832489326348178964194106978875; weight(4) = 0.210746247220398685903797568021; weight(5) = 0.388325022916052063676224499399; weight(6) = 0.554275165518437673725822282791; weight(7) = 0.621388553284444032628761363828; weight(8) = 0.523916296267173054255512857631; weight(9) = 0.262081160888317771694556320674; else fprintf ( 1, '\n' ); fprintf ( 1, 'LEGENDRE_SET_X2 - Fatal error!\n' ); fprintf ( 1, ' Illegal input value of NORDER = %d\n', norder ); error ( 'LEGENDRE_SET_X2 - Fatal error!' ); end