Overvew of the weghtg costats ad the pots where we evaluate the fucto for The Gaussa quadrature Project two By Ashraf Marzouk ChE 505 Fall 005 Departmet of Mechacal Egeerg Uversty of Teessee Koxvlle, TN
Table of Cotets Itroducto Legedre Polyomal Fttg a Polyomal to a set of pots The algorthm of Gaussa Quadrature 5 Gaussa Quadrature - Dervato 5 Appe A Lst of the coeffcet x,i, c, Referece 4 Lst of Fgures Fgure. Legedre polyomal for eve Fgure. Legedre polyomal for odd
. Itroducto Gaussa quadrature seeks to obta the best umercal estmate of a tegral by pckg optmal abscssas x at whch to evaluate the fucto f(x). The fudametal theorem of Gaussa quadrature states that the optmal abscssas of the m pot Gaussa quadrature formulas are precsely the roots of the orthogoal polyomal for the same terval ad weghtg fucto. Gaussa quadrature s optmal because t fts all polyomals up to degree m exactly. I wll troduce Legedre polyomals ad fttg a polyomal to a set of pots because we wll eed them the dervato of Gaussa quadrature.. Legedre Polyomals Cosder the expresso (-rx+r ) -/.. whch x ad r are both less tha or equal to oe. We ca expad the expresso.. by the bomal theorem as a seres of powers of r. Ths s straghtforward, though ot partcularly easy, ad we mght expect to sped several mutes obtag the coeffcets of the frst few powers of r. We wll fd that the coeffcet of r s a polyomal expresso x of degree. Ideed the expaso takes the form (-rx+r ) -/ = P o (x) + P (x) r + P (x) r + P (x) r.. The coeffcets of the successve power of are the Legedre polyomals; the coeffcet of r, whch s P (x), s the Legedre polyomal of order, ad t s a polyomal x cludg terms as hgh as x. If we have coscetously tred to expad expresso.., you wll have foud that P o (x) =, P (x) = x, P (x) = 0.5(x -).. Though we probably gave up wth exhausto after that ad dd t take t ay further. If we look carefully at how we derved the frst few polyomals, we may have dscovered for ourselves that we ca obta the ext polyomal as a fucto of two earler polyomals. we may eve have dscovered for ourselves the followg recurso relato: ( + )xp P P + =..4 + Ths eables us very rapdly to obta hgher order Legedre polyomals, whether umercally or algebrac form. For example, put = ad show that equato..4 results P = ½(x -) we wll the wat to calculate P, ad the P 4, ad more ad more ad more. Aother way to geerate them s form the equato P d + = (x )!..5 Here are the frst eleve Legedre polyomals: Ashraf Marzouk Page //005
Ispecto of the forms of these polyomals wll quckly show that all odd polyomals have a root of zero, ad all ozero roots occur postve/egatve pars. We have shall have o dffculty fdg the roots of these equatos. The roots x,, are appe A, whch also lsts certa coeffcets c,, that wll be explaed secto.. The graphs of the Legedre polyomals are fgures I ad. Fgure I Legedre polyomals for eve Ashraf Marzouk Page //005
Fgure Legedre polyomals for odd For further terest, t should be easy to verfy, by substtuto, that the Legedre polyomals are solutos of the dfferetal equato ( - x ) y xy + ( + I) y = 0..6. Fttg a Polyomal to a Set of Pots. Lagrage polyomals. Lagrage Iterpolato Gve a set of pots o a graph, there ay may possble polyomals of suffcetly hgh degree that go through all of the pots. There s, however, just oe polyomal of degree less tha that wll go through them all. Most readers wll fd o dffculty determg the polyomal. For example, cosder the three pots (, ), (, ), (, ). To fd the polyomal y = a o + a x + a x that goes through them, we smply substtute the three pots tur ad hece set up the three smultaeous equatos = a 0 + a + a = a 0 + a + 4a.. = a 0 + a + 9a ad solve them for the coeffcets. Thus a 0 = -, a =.5 ad a = -0.5. I a smlar maer we ca ft a polyomal of degree - to go exactly through pots. If there are more tha pots, we may wsh to ft a least squares polyomal of degree - to go close to the pots. We are terested fttg a polyomal of degree - exactly through pots, ad we are gog to show how to do ths by meas of Lagrage polyomals. Whle the smallest-degree polyomal that goes through pots s usually of degree -, t could be less tha ths. For example, we mght have four pots, all of whch ft exactly o a parabola (degree two). However, geeral oe would expect the polyomal to be of degree -, ad, f ths s ot the case, all that wll happe s that we shall fd that the coeffcets of the hghest powers of x are zero. Ashraf Marzouk Page //005
That was straghtforward. However, what we are gog to do ths secto s to ft a polyomal to a set of pots by usg some fuctos called Lagrage polyomals. These are fuctos that are descrbed by Max Farbar as cugly egeered to ad wth ths task. Let us suppose that we have a set of pots: (x, y ), (x, y ), (x, y ), (x, y ), (x, y ), ad we wsh to ft a polyomal of degree - to them. we assert that the fucto y = = y L (x).. s the requred polyomal, where the fuctos L (x), =,, are Lagrage polyomals, whch are polyomals of degree - defed by x x j L (x) =.. x x j= ` j Wrtte more explctly, the frst three Lagrage polyomals are (x x )(x x )(x x 4 )...(x x ) L(x) =..4 (x x )(x x )(x x )...(x x ) (x x )(x x )(x x 4 )...(x x ) L (x) = (x x )(x x )(x x )...(x x (x x )(x x )(x x 4 )...(x x ) L (x) = (x x )(x x )(x x )...(x x j 4 4 4..5 )..6 ) At frst ecouter, ths wll appear meagless, but wth a smple umercal example t wll become clear what t meas ad also that t has deed bee cugly egeered for the task. Cosder the same pots as before, amely (, ), (, ), (, ). The three Lagrage polyomals are (x )(x ) L(x) = = (x ( )( ) (x )(x ) L (x) = = x ( )( ) (x )(x ) L (x) = = (x ( )( ) 5x + 6),..7 + 4x,..8 x + ),..9 Equato.. for the polyomal of degree - that goes through the three pots s, the, that s whch agrees wth what we got before. y = *0.5(x -5x+6) + *(-x +4x-) + *0.5(x -x+);..0 y = -0.5x +.5x-.. Ashraf Marzouk Page 4 //005
Oe way or aother, f we have foud the polyomal that goes through the pots, we ca the use the polyomal to terpolate betwee o tabulated pots. Thus we ca ether determe the coeffcets y = a 0 +a x + a x by solvg smultaeous equatos, or we ca use equato.. drectly for our terpolato (wthout the eed to calculate the coeffcets a 0, a, etc.), whch case the techque s kow as Lagraga terpolato. If the tabulated fucto for whch we eed a terpolated value s a polyomal of degree less tha, the terpolated value wll be exact. Otherwse t wll be approxmate.. The Algorthm of Gaussa Quadrature Gaussa quadrature s a alteratve method of umercal tegrato whch s ofte much faster ad more spectacular tha Smpso s rule. Gaussa quadrature allows you to carry out the tegrato f(x).. But what happes f our lmts of tegrato are ot ±? What f we wat to tegrate b F(t)dt?.. a That s o problem at all we just make a chage of varable. Thus, let t a b x =,t = [(b a)x + a + b] b a ad the ew lmts are the x = ±... I ow assert, wthout dervato (see the dervato secto.4), that Let s try t. 5 I = c f(x..4 = 5, 5, ), ad the expresso..4 comes to.000 000 000 04, ad mght presumably have come eve closer to had we gve x,, ad C, to more sgfcat fgures..4 Gaussa Quadrature - Dervato I order to uderstad why Gaussa quadrature works so well, we frst eed to uderstad some propertes of polyomals geeral ad of Legedre polyomals partcular. We also eed to remd ourselves of the use of Lagrage polyomals for approxmatg a arbtrary fucto. Ashraf Marzouk Page 5 //005
Frst, a statemet cocerg polyomals geeral: Let P be a polyomal of degree, ad let S be a polyomal of degree less tha. The, f we dvde S by P, we obta a quotet Q ad a remader R, each of whch s a polyomal of degree less tha. That s to say: S R = Q +.4. P P What ths meas s best uderstood by lookg at a example, wth =, for example, Let Ad P=5x -x + x+7,.4. S=9x 5 +4x 4-5x +6x +x-.4. If we carry out the dvso S/P the ordary process of log dvso we obta 9x 5 + 4x 5x 4 5x x + 6x + x =.8x + x + 7 4.04x + 4.4x 7.04 +.5x.47 5x x + x + 7.4.4 For example f x =, ths becomes 4.04 = 9.88 The theorem gve by equato.. s true for ay polyomal P of degree. I partcular, t s true f P s the Legedre polyomal of degree. Next a mportat property of the Legedre polyomals amely, f P ad P m are Legedre polyomals of degree, ad m respectvely the P P m = 0 uless m=..4.5 Ths property s called the orthogoal property of the Legedre polyomals. Although the proof s straghtforward, t may look formdable at frst. From the symmetry of the Legedre polyomals (see fgure.), the followg are obvous: ad I fact we ca go further, ad as we shall show, P P m 0 f m= P P m = 0 f oe (but ot both) of m or s odd. Ashraf Marzouk Page 6 //005
P P m = 0 uless m=, weather m ad are eve or odd. Thus P m satsfed the dfferetal equato (see equato..6) Whch ca also be wrtte d Pm dpm ( x ) x + m( m + ) Pm = 0.4.6 d [( x dp ) m ] + m( m + ) P = 0.4.7 Multpy by P d dpm P [( x ) ] + m( m + ) Pm P = 0.4.8 Whch ca also be wrtte d [( x ) P dpm ] ( x dp ) dp m + m( m + ) P m P + 0.4.9 I a smlar maer, we have d [( x )( P dp m P m dp )] + [ m( m + ) ( + )] Pm P = 0.4.0 Subtract oe form the other: d [( x )( P dp P m dpm )] + [ m( m + ) ( + )] Pm P = 0.4. Itegrate from - to +: dpm dp [( x )( P Pm )] = [ ( + ) m( m + )] Pm P.4. The left had sde s zero because -x s zero at both lmts. There for, uless m= P P m = 0.4. We ow assert that, f P s the Legedre polyomal of degree, ad f Q s ay polyomal of degree less tha, the P Q = 0.4.4 We shall frst prove ths, ad the gve ad example to see what t meas. To start the proof we recall the recurso relato (see equato..4-through here we are substtutg - for ) for the Legedre polyomals: Ashraf Marzouk Page 7 //005
P = (-)xp - (-)P -.4.5 The proof wll be ducto. Let Q be ay polyomal of degree les tha. Multply the above relato by Q ad tegrate from - to +: P Q = ( ) xp Q ( ) P.4.6 If the rght had sde s zero, the the left had sde s also zero. For example, let =4, so that ad ad let P - =P =0.5(x -).4.7 xp - =xp =0.5(5x 4 -x ),.4.8 Q=(a x +a x +a x+a 0 ).4.9 It s the straghtforward (ad oly slghtly tedous) to show that Ad that But Ad therefore We have show that 6 P Q = ( ) a.4.0 5 0 6 xp Q = ( ) a.4. 7 5 0 6 6 ( ) a ( ) a = 0.4. 7 5 5 7 P 4Q = 0.4. P = 0 P Q = ) xp Q ( ) ( Q.4.4 For =4, ad therefore t s true for all postve tegral. Ashraf Marzouk Page 8 //005
We ca use ths property for a parlour trck. For example, you ca say Thk of ay polyomal. Do t tell me what t s Just tell me ts degree. The multply t by (here gve a Legedre polyomal of degree more tha ths). Now tegrate form - to +. The aswer s zero rght? (Applause). Thus: Thk of ay polyomal. x -5x+7. Now multply t by 5x - x. Ok, that s 5x 5-5x 4 - x + 5x - x. Now tegrate t from - to +. The aswer s zero. Now, let S be ay polyomal of degree less tha. Let us dvde t b the Legedre polyomal of degree, P to obta the quotet Q ad a remader R, both of degree less tha. The assert that S R.4.5 = Ths follows trvally from equato.4. ad.4.4. Thus Example: Let S=6x 5 -x 4 +4x +7x -5x+7. = (QP + R) = S R.4.6 The tegral of ths from - to + s.86. If we dvde S by 0.5(5x -x), we obta a quotet of.4x -4.8x+.04 ad a remader of -0.x -0.44x+7. The tegral of the latter from - to + s also.86 I have just descrbed some propertes of Legedre polyomals. Before gettg o to the ratoale behd Gaussa quadrature, let us remd ourselves from Secto. about Lagrage polyomals. We recall from that secto that, f we have a set of pots, the followg fucto: y = y L (x).4.7 = ( whch the fuctos L (x), =,, are Lagrage polyomals of degree -) s the polyomal of degree - that passes exactly through the pots. Also, f we have some fucto f(x) whch we evaluate at pots, the the polyomal y = f(x )L (x).4.8 = s a jolly good approxmato to f(x) ad deed may be used to terpolated betwee otabulated pots, eve f the fucto s tabulated at rregular tervals. I partcular, f f(x) s a polyomal of degree -, the the expresso..8 s a exact represetato of f(x). We are ow ready to start talkg about quadrature. We fsh to approxmate f(x) C f(x ),.4.9 = f(x) by ad -term fte seres Where - < x <. To ths ed, we ca approxmate f(x) by the rght had sde of equato s.4.8, so that Ashraf Marzouk Page 9 //005
f(x L(x) = f(x ) ) L(x). = = f(x).4.0 Recall that the Lagrage polyomals ths expresso are of degree -. The requred coeffcets for equato.4.9 are therefore = L C (x)..4. Note that at ths stage the values of the x have ot yet bee chose; they are merely restrcted to the terval [-, ]. Now let s cosder S(x), where S s a polyomal of degree less tha, such as, for example, the polyomal of equato.4.. We ca wrte = S(x) = S(x )L (x) = L (x)[q(x )P(x ) + R(x )].4. = Here, as before, P s a polyomal of degree, ad Q ad R are of degree less tha. If we ow choose the x to be the roots of the Legedre polyomals, the = S(x) = L (x)r(x ).. Note that the tegrad o the rght had sde of equato.6. s a exact represetato of R(x). But we have already show (equato.4.6) that = R(x) = C R(x ) = CS(x ) = = S(x).4.4 It follows that the Gaussa quadrature method, f we choose the roots of the Legedre polyomals for the abscssas, wll yeld exact results for ay polyomal of degree less tha, ad wll yeld a good approxmato to the tegral f S(x) s a polyomal represetato of a geeral fucto f(x) obtaed by fttg a polyomal to several pots o the fucto. Ashraf Marzouk Page 0 //005
Roots of P l = 0 46 l x l c, l, ± 0.577 50 69 90.000 000 000 00 ± 0.774 596 669 4 0.000 000 000 000 0.555 555 555 56 0.888 888 888 89 4 ± 0.86 6 594 ± 0.9 98 04 585 0.47 854 845 4 0.65 45 54 86 5 ± 0.906 79 845 99 ± 0.58 469 0 06 0.000 000 000 000 0.6 96 885 06 0.478 68 670 50 0.568 888 888 89 6 ± 0.9 469 54 0 ± 0.66 09 86 466 ± 0.8 69 86 08 0.7 4 49 8 0.60 76 57 05 0.467 9 94 57 7 ± 0.949 07 9 4 ± 0.74 5 85 599 ± 0.405 845 5 77 0.000 000 000 000 0.9 484 966 7 0.79 705 9 49 0.8 80 050 50 0.47 959 8 68
l, 47 x l c l, 8 ± 0.960 89 856 498 ± 0.796 666 477 44 ± 0.55 5 409 96 ± 0.8 44 64 496 0.0 8 56 9 0. 8 0445 0. 706 645 88 0.6 68 78 8 9 ± 0.968 60 9 508 ± 0.86 0 07 7 ± 0.6 7 4 70 ± 0.4 5 4 404 0.000 000 000 000 0.08 74 88 6 0.80 648 60 69 0.60 60 696 40 0. 47 077 04 0.0 9 55 00 0 ± 0.97 906 58 57 ± 0.865 06 66 689 ± 0.679 409 568 99 ± 0.4 95 94 9 ± 0.48 874 8 98 0.066 67 4 99 0.49 45 49 64 0.9 086 6 4 0.69 66 79 47 0.95 54 4 66!0.978 8 658 46 0.055 668 567!0.887 06 599 768 0.5 580 69 46!0.70 5 005 574 0.86 90 0 9!0.59 096 9 07 0. 9 764 59!0.69 54 55 95 0.6 804 544 5 0.000 000 000 000 0.7 95 086 78!0.98 560 64 47 0.047 75 6 9!0.904 7 56 70 0.06 99 5 99!0.769 90 674 94 0.60 078 8 54!0.587 7 954 87 0.0 67 46 7!0.67 8 498 998 0. 49 56 54!0.5 408 5 0.49 47 045 8!0.984 8 054 79 0.040 484 004 77!0.97 598 99 0.09 499 84!0.80 578 090 7 0.8 87 50!0.64 49 9 440 0.78 45 980 76!0.448 49 75 06 0.07 86 047 54!0.0 458 5 955 0.6 8 80 6 0.000 000 000 000 0. 55 55
48 4!0.986 8 808 697 0.05 9 460!0.98 44 88 664 0.080 58 087 6!0.87 0 5 070 0. 58 570 69!0.687 9 904 8 0.57 0 67 6!0.55 48 66 58 0.85 58 97 48!0.9 68 98 0.05 98 46 7!0.08 054 948 707 0.5 6 85 46 5!0.987 99 58 00 0.00 75 4 00!0.97 7 9 40 0.070 66 047 49!0.848 06 58 40 0.07 59 0 47!0.74 47 7 60 0.9 570 677 9!0.570 97 7 609 0.66 69 05 8!0.94 5 47 078 0.86 6 000 0!0.0 94 09 997 0.98 4 485 0.000 000 000 000 0.0 578 4 9 6!0.989 400 94 99 0.07 5 459 4!0.944 575 0 07 0.06 5 5 94!0.865 6 0 88 0.095 58 5 68!0.755 404 408 55 0.4 68 97 6!0.67 876 44 40 0.49 595 988 8!0.458 06 777 657 0.69 56 59 9!0.8 60 550 779 0.8 60 45 04!0.095 0 509 88 0.89 450 60 46 7!0.990 575 475 5 0.04 48 0 87!0.950 675 5 769 0.055 459 59 8!0 880 9 5 77 0.085 06 48!0.78 54 00 897 0. 88 847 9!0.657 67 59 7 0.5 6 68 47!0.5 690 57 086 0.54 045 76 08!0.5 76 454 0.68 004 0 6!0.78 484 8 496 0.76 56 705 7 0.000 000 000 000 0.79 446 470 5
Refereces. http://www.lfelog-learers.com/pde/syl/sode.php. http://mathworld.wolfram.com/gaussaquadrature.html. http://e.wkpeda.org/wk/gaussa_quadrature 4. http://tegrals.wolfram.com/ Ashraf Marzouk Page 4 //005