function [ xtab, weight ] = legendre_set_x1 ( norder ) %*****************************************************************************80 % %% LEGENDRE_SET_X1 sets a Gauss-Legendre rule for ( 1 + X ) * F(X) on [-1,1]. % % Integration region: % % [ -1, 1 ] % % Weight function: % % 1 + X % % Integral to approximate: % % INTEGRAL ( -1 <= X <= 1 ) ( 1 + X ) * 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.333333333333333333333333333333E+00; weight(1) = 2.0E+00; elseif ( norder == 2 ) xtab(1:2) = [ ... -0.289897948556635619639456814941E+00, ... 0.689897948556635619639456814941E+00 ]; weight(1:2) = [ ... 0.727834473024091322422523991699E+00, ... 1.27216552697590867757747600830E+00 ]; elseif ( norder == 3 ) xtab(1:3) = [ ... -0.575318923521694112050483779752E+00, ... 0.181066271118530578270147495862E+00, ... 0.822824080974592105208907712461E+00 ]; weight(1:3) = [ ... 0.279307919605816490135525088716E+00, ... 0.916964425438344986775682378225E+00, ... 0.803727654955838523088792533058E+00 ]; elseif ( norder == 4 ) xtab(1:4) = [ ... -0.720480271312438895695825837750E+00, ... -0.167180864737833640113395337326E+00, ... 0.446313972723752344639908004629E+00, ... 0.885791607770964635613757614892E+00 ]; weight(1:4) = [ ... 0.124723883800032328695500588386E+00, ... 0.519390190432929763305824811559E+00, ... 0.813858272041085443165617903743E+00, ... 0.542027653725952464833056696312E+00 ]; elseif ( norder == 5 ) xtab(1:5) = [ ... -0.802929828402347147753002204224E+00, ... -0.390928546707272189029229647442E+00, ... 0.124050379505227711989974959990E+00, ... 0.603973164252783654928415726409E+00, ... 0.920380285897062515318386619813E+00 ]; weight(1:5) = [ ... 0.0629916580867691047411692662740E+00, ... 0.295635480290466681402532877367E+00, ... 0.585547948338679234792151477424E+00, ... 0.668698552377478261966702492391E+00, ... 0.387126360906606717097443886545E+00 ]; elseif ( norder == 6 ) xtab(1:6) = [ ... -0.853891342639482229703747931639E+00, ... -0.538467724060109001833766720231E+00, ... -0.117343037543100264162786683611E+00, ... 0.326030619437691401805894055838E+00, ... 0.703842800663031416300046295008E+00, ... 0.941367145680430216055899446174E+00 ]; weight(1:6) = [ ... 0.0349532072544381270240692132496E+00, ... 0.175820662202035902032706497222E+00, ... 0.394644603562621056482338042193E+00, ... 0.563170215152795712476307356284E+00, ... 0.542169988926074467362761586552E+00, ... 0.289241322902034734621817304499E+00 ]; elseif ( norder == 7 ) xtab(1:7) = [ ... -0.887474878926155707068695617935E+00, ... -0.639518616526215270024840114382E+00, ... -0.294750565773660725252184459658E+00, ... 0.0943072526611107660028971153047E+00, ... 0.468420354430821063046421216613E+00, ... 0.770641893678191536180719525865E+00, ... 0.955041227122575003782349000858E+00 ]; weight(1:7) = [ ... 0.0208574488112296163587654972151E+00, ... 0.109633426887493901777324193433E+00, ... 0.265538785861965879934591955055E+00, ... 0.428500262783494679963649011999E+00, ... 0.509563589198353307674937943100E+00, ... 0.442037032763498409684482945478E+00, ... 0.223869453693964204606248453720E+00 ]; elseif ( norder == 8 ) xtab(1:8) = [ ... -0.910732089420060298533757956283E+00, ... -0.711267485915708857029562959544E+00, ... -0.426350485711138962102627520502E+00, ... -0.0903733696068532980645444599064E+00, ... 0.256135670833455395138292079035E+00, ... 0.571383041208738483284917464837E+00, ... 0.817352784200412087992517083851E+00, ... 0.964440169705273096373589797925E+00 ]; weight(1:8) = [ ... 0.0131807657689951954189692640444E+00, ... 0.0713716106239448335742111888042E+00, ... 0.181757278018795592332221684383E+00, ... 0.316798397969276640481632757440E+00, ... 0.424189437743720042818124385645E+00, ... 0.450023197883549464687088394417E+00, ... 0.364476094545494505382889847132E+00, ... 0.178203217446223725304862478136E+00 ]; elseif ( norder == 9 ) xtab(1:9) = [ ... -0.927484374233581078117671398464E+00, ... -0.763842042420002599615429776011E+00, ... -0.525646030370079229365386614293E+00, ... -0.236234469390588049278459503207E+00, ... 0.0760591978379781302337137826389E+00, ... 0.380664840144724365880759065541E+00, ... 0.647766687674009436273648507855E+00, ... 0.851225220581607910728163628088E+00, ... 0.971175180702246902734346518378E+00 ]; weight(1:9) = [ ... 0.00872338834309252349019620448007E+00, ... 0.0482400171391415162069086091476E+00, ... 0.127219285964216005046760427743E+00, ... 0.233604781180660442262926091607E+00, ... 0.337433287379681397577000079834E+00, ... 0.401235236773473158616600898930E+00, ... 0.394134968689382820640692081477E+00, ... 0.304297020437232650320317215016E+00, ... 0.145112014093119485838598391765E+00 ]; else fprintf ( 1, '\n' ); fprintf ( 1, 'LEGENDRE_SET_X1 - Fatal error!\n' ); fprintf ( 1, ' Illegal input value of NORDER = %d\n', norder ); error ( 'LEGENDRE_SET_X1 - Fatal error!\n' ); end return end