function [ xtab, weight ] = legendre_set_x2 ( norder ) %% LEGENDRE_SET_X2 sets a Gauss-Legendre rule for ( 1 + X )**2 * F(X) on [-1,1]. % % Integration region: % % [ -1, 1 ] % % Weight function: % % ( 1 + X )**2 % % Integral to approximate: % % INTEGRAL ( -1 <= X <= 1 ) ( 1 + X )**2 * F(X) dX % % Approximate integral: % % SUM ( 1 <= I <= NORDER ) WEIGHT(I) * F ( XTAB(I) ) % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 20 May 2004 % % Author: % % John Burkardt % % Reference: % % Arthur Stroud and Don Secrest, % Gaussian Quadrature Formulas, % Prentice Hall, 1966, Table #3. % % 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.5E+00; weight(1) = 2.66666666666666666666666666666E+00; elseif ( norder == 2 ) xtab(1:2) = [ ... -0.0883036880224505775998524725910E+00, ... 0.754970354689117244266519139258E+00 ]; weight(1:2) = [ ... 0.806287056638603444666851075928E+00, ... 1.86037961002806322199981559074E+00 ]; elseif ( norder == 3 ) xtab(1:3) = [ ... -0.410004419776996766244796955168E+00, ... 0.305992467923296230556472913192E+00, ... 0.854011951853700535688324041976E+00 ]; weight(1:3) = [ ... 0.239605624068645584091811926047E+00, ... 1.16997015407892817602809616291E+00, ... 1.25709088851909290654675857771E+00 ]; elseif ( norder == 4 ) xtab(1:4) = [ ... -0.591702835793545726606755921586E+00, ... -0.0340945902087350046811467387661E+00, ... 0.522798524896275389882037174551E+00, ... 0.902998901106005341405865485802E+00 ]; weight(1:4) = [ ... 0.0828179259993445222751812523731E+00, ... 0.549071097383384602539010760334E+00, ... 1.14767031839371367238662411421E+00, ... 0.887107324890223869465850539752E+00 ]; elseif ( norder == 5 ) xtab(1:5) = [ ... -0.702108425894032836232448374820E+00, ... -0.268666945261773544694327777841E+00, ... 0.220227225868961343518209179230E+00, ... 0.653039358456608553790815164028E+00, ... 0.930842120163569816951085142737E+00 ]; weight(1:5) = [ ... 0.0329106016247920636689299329544E+00, ... 0.256444805783695354037991444453E+00, ... 0.713601289772720001490035944563E+00, ... 1.00959169519929190423066348132E+00, ... 0.654118274286167343239045863379E+00 ]; elseif ( norder == 6 ) xtab(1:6) = [ ... -0.773611232355123732602532012021E+00, ... -0.431362254623427837535325249187E+00, ... -0.0180728263295041680220798103354E+00, ... 0.395126163954217534500188844163E+00, ... 0.736872116684029732026178298518E+00, ... 0.948190889812665614490712786006E+00 ]; weight(1:6) = [ ... 0.0146486064549543818622276447204E+00, ... 0.125762377479560410622810097040E+00, ... 0.410316569036929681761034600615E+00, ... 0.756617493988329628546336413760E+00, ... 0.859011997894245060846045458784E+00, ... 0.500309621812647503028212451747E+00 ]; elseif ( norder == 7 ) xtab(1:7) = [ ... -0.822366333126005527278634734418E+00, ... -0.547034493182875002223997992852E+00, ... -0.200043026557985860387937545780E+00, ... 0.171995710805880507163425502299E+00, ... 0.518891747903884926692601716998E+00, ... 0.793821941703901970495546427988E+00, ... 0.959734452453198985538996625765E+00 ]; weight(1:7) = [ 0.00714150426951365443207221475404E+00, ... 0.0653034050584375560578544725498E+00, ... 0.235377690316228918725962815880E+00, ... 0.505171029671130381676271523850E+00, ... 0.733870426238362032891332767175E+00, ... 0.725590596901489156295739839779E+00, ... 0.394212014211504966587433032679E+00 ]; elseif ( norder == 8 ) xtab(1:8) = [ ... -0.857017929919813794402037235698E+00, ... -0.631543407166567521509503573952E+00, ... -0.339104543648722903660229021109E+00, ... -0.0111941563689783438801237300122E+00, ... 0.316696017045595559454075475675E+00, ... 0.609049663022520165351466780939E+00, ... 0.834198765028697794599267293239E+00, ... 0.967804480896157932935972899807E+00 ]; weight(1:8) = [ ... 0.00374814227227757804631954025851E+00, ... 0.0357961737041152639660521680263E+00, ... 0.137974910241879862433949246199E+00, ... 0.326515411108352185491692769217E+00, ... 0.547577467373226177976217604887E+00, ... 0.682278153375510121675529810121E+00, ... 0.614544746137780998436053880546E+00, ... 0.318231662453524478640851647411E+00 ]; elseif ( norder == 9 ) xtab(1:9) = [ ... -0.882491728426548422828684254270E+00, ... -0.694873684026474640346360850039E+00, ... -0.446537143480670863635920316400E+00, ... -0.159388112702326252531544826624E+00, ... 0.141092709224374414981503995427E+00, ... 0.428217823321559204544020866175E+00, ... 0.676480966471850715860378175342E+00, ... 0.863830940812464825046988286026E+00, ... 0.973668228805771018909618924364E+00 ]; weight(1:9) = [ ... 0.00209009877215570354392734918986E+00, ... 0.0205951891648697848186537272448E+00, ... 0.0832489326348178964194106978875E+00, ... 0.210746247220398685903797568021E+00, ... 0.388325022916052063676224499399E+00, ... 0.554275165518437673725822282791E+00, ... 0.621388553284444032628761363828E+00, ... 0.523916296267173054255512857631E+00, ... 0.262081160888317771694556320674E+00 ]; 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