CE 025 - Lecture 6 LECTURE 6 GAUSS QUADRATURE In general for ewton-cotes (equispaced interpolation points/ data points/ integration points/ nodes). x E x S fx dx hw' o f o + w' f + + w' f + E 84 f 0 f f f 2 closed formula x s x 0 x x 2 x E x h ote that for ewton-cotes formulae only the weighting coefficients w i were unknown and the were fixed x i p. 6.
CE 025 - Lecture 6 However the number of and placement of the integration points influences the accuracy of the ewton-cotes formulae: even th degree interpolation function exactly integrates an + th degree polynomial This is due to the placement of one of the data points. odd th degree interpolation function exactly integrates an th degree polynomial. Concept: Let s allow the placement of the integration points to vary such that we further increase the degree of the polynomial we can integrate exactly for a given number of integration points. In fact we can integrate an 2 + degree polynomial exactly with only + integration points p. 6.2
CE 025 - Lecture 6 Assume that for Gauss Quadrature the form of the integration rule is x E fx dx w o f o + w f + + w f + E x S 85 f 0 f f f f2 x s x 0 x x 2 x x x E In deriving (not applying) these integration formulae Location of the integration points, x i i O are unknown Integration formulae weights, w i i O are unknown 2 + unknowns we will be able to exactly integrate any 2 + degree polynomial! p. 6.
CE 025 - Lecture 6 Derivation of Gauss Quadrature by Integrating Exact Polynomials and Matching Derive point Gauss-Quadrature 2 unknowns, which will exactly integrate any linear function w o x o Let the general polynomial be fx Ax + B where the coefficients A Bcan equal any value Also consider the integration interval to be + such that x S and x E + (no loss in generality since we can always transform coordinates). + fx dx w o fx o Substituting in the form of fx + Ax + B d x w o Ax o + B p. 6.4
CE 025 - Lecture 6 A x2 ---- + Bx 2 + w o Ax o + B In order for this to be true for any st degree polynomial (i.e. any A and B). Therefore x o 0, w o 2 for point Gauss Quadrature. 86 A0 + B2 Ax o w o + Bw o 0 x o w o 2 w o f 0 f(x) - x 0 + We can integrate exactly with only point for a linear function while for ewton-cotes we needed two points! p. 6.5
CE 025 - Lecture 6 Derive a 2 point Gauss Quadrature Formula 87 - x 0 x + The general form of the integration formula is w o, x o, w, x are all unknowns I w o f o + w f 4 unknowns we can fit a rd degree polynomial exactly fx Ax + Bx 2 + Cx + D Substituting in for fx into the general form of the integration rule + fx dx w o fx o + w fx p. 6.6
CE 025 - Lecture 6 + Ax + Bx 2 + Cx + D d x w o Ax o + Bx 2 o + Cx o + D + w Ax + Bx 2 + Cx + D Ax -------- 4 4 Bx Cx + -------- + -------- 2 + Dx 2 + w o Axo + Bx 2 o + Cx o + D + w Ax + Bx 2 + Cx + D Aw o xo + w x B w o x 2 o w x 2 2 + + -- + Cw o x o + w x + Dw o + w 2 0 In order for this to be true for any third degree polynomial (i.e. all arbitrary coefficients, A, B, C, D), we must have: w o xo + w x 0 w o xo 2 w x 2 2 + -- 0 w o x o + w x 0 w o + w 2 0 p. 6.7
CE 025 - Lecture 6 4 nonlinear equations 4 unknowns w o and w x o -- and x + -- All polynomials of degree or less will be exactly integrated with a Gauss-Legendre 2 point formula. p. 6.8
CE 025 - Lecture 6 Gauss Legendre Formulae I + fxdx i 0 w i f i + E + x i, 0 0 2 2, --, + -- 2-0.774597, 0, +0.774597 i 0 w i 0.5555, 0.8889, 0.5555 Exact for polynomials of degree + 2 + 5 p. 6.9
CE 025 - Lecture 6 + x i, 4-0.866-0.99804 0.99804 0.866 4 5-0.9067985-0.58469 0.00000000 0.58469 0.9067985 5 6-0.924695-0.662099-0.28699 0.28699 0.662099 0.924695 i 0 w i 0.4785485 0.652455 0.652455 0.4785485 0.2692689 0.47862867 0.56888889 0.47862867 0.2692689 0.72449 0.607657 0.46799 0.46799 0.607657 0.72449 Exact for polynomials of degree 7 9 p. 6.0
CE 025 - Lecture 6 otes + the number of integration points Integration points are symmetrical on + Formulae can be applied on any interval using a coordinatetransformation + integration points will integrate polynomials of up to degree 2 + exactly. Recall that ewton Cotes + integration points only integrates an th / + th degree polynomial exactly depending on being odd or even. For Gauss-Legendre integration, we allowed both weights and integration point locations to vary to match an integral exactly more d.o.f. allows you to match a higher degree polynomial! An alternative way of looking at Gauss-Legendre integration formulae is that we use Hermite interpolation instead of Lagrange interpolation! (How can this be since Hermite interpolation involves derivatives let s examine this!) p. 6.
CE 025 - Lecture 6 Derivation of Gauss Quadrature by Integrating Hermite Interpolating Functions Hermite interpolation formulae Hermite interpolation which matches the function and the first derivative at + interpolation points is expressed as: gx i 0 i xf i + i 0 i xf i 88 () () () () () () () f 0 f 0 f f f 2 f 2 f f f 4 f 4 f5 f 5 f f 0 2 4 5 x 0 x x 2 x x 4 x 5 x It can be shown that in general for non-equispaced points i x t i xl i xl i x i 0 i x s i xl i xl i x i 0 p. 6.2
CE 025 - Lecture 6 where p x x x o x x x x l i x p x -------------------------------------- i 0 x p x i x i xi t i x x x i 2 l i s i x x x i p. 6.
CE 025 - Lecture 6 Example of defining a cubic Hermite interpolating function Derive Hermite interpolating functions for 2 interpolation points located at and + for the interval +. 89 () f 0 f 0 () f f x 0 x + x + 2 points Establish p x p x x x o x x p x x x o + x x p. 6.4
CE 025 - Lecture 6 Establish l i x l i x l i x p x ---------------------------------------- x p xi x i x x o x x -------------------------------------------------------------------- x x i x i x o + x i x Let i 0 l o x x x o x x ----------------------------------------------------- x x o 0 + x o x l o x x x --------------- x o x Substitute in x o and x + l o x -- x 2 p. 6.5
CE 025 - Lecture 6 Let i l x x x o x x ----------------------------------------------------- x x x x o + 0 Substitute in values for x o, x l x -- + x 2 Taking derivatives l o x 2 -- l x + --- 2 p. 6.6
CE 025 - Lecture 6 Establish t i x t o x x x o 2l o x o t o x x + 2 2 -- t o x 2 + x t x x x 2 l x t x x 2 2 -- t x 2 x Establish s i x s o x x + s x x p. 6.7
CE 025 - Lecture 6 Establish i x o x t o xl o xl o x o x 2 + x 2 -- x 2 -- x o x -- 2 x + x 4 x t xl xl x x 2 x 2 -- + x 2 -- + x x -- 2 + x x 4 p. 6.8
CE 025 - Lecture 6 Establish i x o x s o xl o xl o x o x x + 2 -- x 2 -- x o x -- x x 4 2 + x x s xl xl x x x 2 -- + x 2 -- + x x -- x + x 4 2 + x In general gx o x f o + x f + o x f + x f o p. 6.9
CE 025 - Lecture 6 90 i (x) () i (x) 0 (x) (x) () (x) i (x) x () i (x) () 0 (x) x 0 (x) () 0 () (x) x x These functions satisfy the constraints i x j ij i x j 0 i x i j 0 x j ij p. 6.20
CE 025 - Lecture 6 Gauss-Legendre Quadrature by integrating Hermite interpolating polynomials I otes + fx dx w i f i + E i 0 Use + without loss of generality we can always transform the interval. Approximation for I is exact for 2 + degree polynomials We can derive all Gauss-Legendre quadrature formulae by approximating fx with an 2 + th degree Hermite interpolating function using specially selected integration/ interpolation points. where I + gxdx + E gx i 0 i xf i + i 0 i xf i p. 6.2
CE 025 - Lecture 6 Thus I + i xf i + i xf i dx + E i 0 i 0 I A i f i + B i f i + E i 0 i 0 where A i + + i xdx and B x dx i i Furthermore we can show that E + 2 p + x ---------------------- 2 + 2! f 2 + 2 x o + H.O.T. dx p. 6.22
CE 025 - Lecture 6 ote that we are assuming Taylor series expansions about x o and using higher order terms in the expansion. Therefore E 0 for any polynomial of degree 2 + or less! The problem that we encounter is that the integration formula as it now stands in general requires us to know both functional and first derivative values at the nodes! Let us select x o x x 2 x such that B i 0 i 0 + i x dx 0 i 0 + s i x l xl xdx 0 i 0 i i + p x x x i ----------------------------------- l i x dx 0 i 0 x p xi x i p. 6.2
CE 025 - Lecture 6 ----------------- xi p xl i x dx 0 i 0 p + p x polynomial of degree + l i x polynomial of degree Therefore we require p x to be orthogonal on + to all polynomials of degree or less any multiple of Legendre-Polynomials will satisfy this. Let p x 2 ----------------------------------------P + +! 2 2 +! + x where p x x x o x x x x 2 x x P + the Legendre polynomial of degree + 2 ---------------------------------------- + +! 2 is required to normalize the leading coefficient of 2 +! P + x p. 6.24
CE 025 - Lecture 6 What have we done by defining p x in this way we have selected the integration/ interpolation/data points x o x x to be the roots of P + x. In general P n x ---------- dn x 2 2 n -------------------------- n! dx n n P o x P x x P 2 x --x 2 2 P x --5x 2... x p. 6.25
CE 025 - Lecture 6 So far we have established Selecting p x to be proportional to the Legendre Polynomial of degree + this satisfies the orthogonality condition which will lead to: f i + i x dx 0 As a result terms will not appear in the Gauss-Legendre integration formula. If we select p x to be the Legendre Polynomial of degree + the roots of that polynomial will represent the interpolating/integration/data points since p x x x o x x x x has been set equal to CP + x ow we must find the weights of the integration formula. ote that A i will represent the weights! A i + i xdx p. 6.26
CE 025 - Lecture 6 where A i + t i x l i x l i xdx xi t i x x x i 2 l i l i x p x ----------------------------------- x p xi x i p x x x o x x and where x o x are the roots of the Legendre polynomial of degree + or p x 2 ----------------------------------------P + +! 2 2 +! + x p. 6.27
CE 025 - Lecture 6 Two point Gauss-Legendre integration Develop a 2 point Gauss-Legendre integration formula for +. Let gx gx j 0 i xf i o xf o + j 0 i xf i + xf + o xf o + xf Thus I + gxdx + E I + o xf o dx + + xf dx + o xf o dx + + + xf dx + I f o o x d x f x d x f o o x dx + + + f + + + xdx p. 6.28
CE 025 - Lecture 6 Step - Establish interpolating points Interpolation points will be the roots of the Legendre Polynomial of order 2. P 2 x --x 2 2 --x 2 2 0 x 2 x 2 -- x 0 -- x 0 0.5775 p. 6.29
CE 025 - Lecture 6 Checking these roots P 2 x ---------- d2 x 2 2 2 -------------------------- 2 2! dx 2 P 2 x -- ------- d2 8dx 2 x 4 2x 2 + P 2 x --2x 8 2 4 P 2 x --x 2 2 p x 2 ----------------- 2 2! 2 22! P x 2 p x 4 4 ----------------- --x 4 2 2 2 p x x 2 -- p. 6.0
CE 025 - Lecture 6 From formula which defines p x using the integration points p x x + -- x -- x2 -- Step 2 - Establish the coefficients of the derivative terms in the integration formula Let s demonstrate that with the roots x o 0.5775 we will satisfy + + o x dx 0 and x d x 0 First develop o x and x by developing s o x and s x p x, p x, lo x, l x, p x x x o x x p x x xo + x x p. 6.
CE 025 - Lecture 6 l j x p x -------------------------------------- x p j 0 x j x j l j x x x o x x -------------------------------------------------------------------- x x j x j x o + x j x l o x x x o x x -------------------------------------------------------------- x x o x o x o + x o x l o x x x --------------- x o x l x x x o x x ----------------------------------------------------------------------- x x x x o + x x l x x x o --------------- x x o p. 6.2
CE 025 - Lecture 6 s o x x x o s x x x ow we can establish o x o x s o x l o x l o x x x o x x x o --------------- x x --------------- x o x x o x oting that x o --, x -- o x x + x -- -- x -- ------------------------------------------ -- -- 2 o x -- x 4 --x 2 --x + -- 2 / p. 6.
CE 025 - Lecture 6 Similarly for x x s x l x l x x x o x x o x x x -------------------- -------------------- x x o x x o Substituting x o --, x -- x x -- x + -- x + -- ----------------------------------------------------------------- -- + -- 2 x -- x 4 --x 2 + --x -- 2 / p. 6.4
CE 025 - Lecture 6 ow we can develop + o xdx + o xdx + -- x 4 --x 2 --x + -- 2 / dx + o xdx 4 ---- -- 4 2 -- x4 / x --x 6 2 / x + -- 2 + + o xdx -- 4 -- -- 4 2 / -- + -- 6 2 / -- -- 4 2 / + -- -- 6 2 / + o x dx 0 p. 6.5
CE 025 - Lecture 6 Develop + xdx + xdx + -- x 4 --x 2 + --x -- 2 / dx + xdx 4 ---- -- 4 2 / x --x 6 2 + -- 2 -- x4 / x + + xdx -- 4 -- -- 4 / 2 + -- -- 6 2 / -- -- 4 2 / -- 6 + -- 2 / + x dx 0 p. 6.6
CE 025 - Lecture 6 ow our integration formula reduces to: + + I f o o xdx + f xdx I A o f o + A f where A o + o xdx and A xdx + Step - Develop A o, A Establish o x o x t o x l o x l o x xo o x x x o 2l o l o xl o x p. 6.7
CE 025 - Lecture 6 2 o x x x o --------------- x x x o x --------------- x x --------------- x o x x o x o x x + -- 2 x -- x -- ------------------------ ------------------------------------------------------------- -- -- -- -- -- -- o x 4 -- x + -- 2 ------------- 2 x 2 2 -- --x + -- o x 2 --------- ------ + x 4 x 2 2 --x + -- o x -- x 4 x + 2 -- 2 / p. 6.8
CE 025 - Lecture 6 Develop + o xdx + o xdx + 4 -- x x + 2 -- / 2 dx + o xdx -- x4 ---- 4 4 x ---- 2 + 2 2 -- 2 / x + + o xdx -- 4 -- -- + 2 4 2 -- 2 / -- -- 2 4 2 -- 2 / + o xdx -- 4 4 -- -- + o x dx A o p. 6.9
CE 025 - Lecture 6 Similarly we can show that A + x dx Thus we have established the two point Gauss Quadrature rule I + f x dx w o f o + w f where x o -- and x are the integration points and + -- w o w We note that this integration rule was established by defining a Hermite cubic interpolating function and defining the integration points x o, x such that + o x dx 0 and x d x 0 + Therefore the functional derivative values drop out of the Gauss Legendre integration formula! p. 6.40