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