LECTURE 14 NUMERCAL NTEGRATON Find b a fxdx or b a vx ux fx ydy dx Often integration is required. However te form of fx may be suc tat analytical integration would be very difficult or impossible. Use numerical integration tecniques. Finite element (FE) metods are based on integrating errors over a domain. Typically we use numerical integrators. Numerical integration metods are developed by integrating interpolating polynomials. p. 14.1
Trapezoidal Rule Trapezoidal rule uses a first degree Lagrange approximating polynomial ( N 1, N + 1 nodes, linear interpolation). 76 f 0 f(x) g(x) f 1 x 0 Define te linear interpolating function gx f x o --------------- x + f 1 --------------- Establis te integration rule by computing fxdx gx + ex dx p. 14.
gxdx + E f x o --------------- x f 1 --------------- + dx + E x x ---- f o ------------------ x ---- x o x + f 1 ------------------ + E x 1 x 1 ------ f o -------------------- + x 1 f 1 ------ x 1 ----------------------- ---- f o --------------------- x o f 1 ---- x o --------------- x o + E Trapezoidal Rule ---------------- fo + f 1 + E p. 14.3
Trapezoidal Rule integrates te area of te trapezoid between te two data or interpolation points. Evaluating te error for trapezoidal rule. Te error E is dependent on te integral of te difference ex fx gx. However integrating te dependent error approximation for te interpolating function does not work out in general since is a function of x! We must express ex in terms of a series of terms expanded about in order to evaluate E exdx correctly. An alternative strategy is to evaluate E fxdx --------------- fo + f 1 by developing Taylor series expansions for fx, f o and f 1. We do note tat as E p. 14.4
Evaluation of te Error for Trapezoidal Rule Evaluation of te error by integrating e(x) We note tat x N xn x N E gxdx E fxdx gxdx However x N x N x N ex fx gx ex dx fx dx gxdx Tus x N E exdx Recall tat ex for Lagrange interpolation was expressed as: ex --------------------------------------------------------------- x x x x N N + 1! f N + 1 p. 14.5
Notes Procedure applies to iger order integration rules as well. n general is a function of x Neglecting te dependence of x, can lead to incorrect results. e.g. for Simpson s 1 -- rule you will integrate out te dependent term and te result would be E 0! 3 A way you can apply E exdx is to take ex as a series of terms! Ten we will always get te correct answer! Evaluation of te error for Trapezoidal Rule by Taylor Series expansion E --------------- fo + f 1 E fxdx --------------- fo + f 1 p. 14.6
Let s now develop Taylor series expansions for fx, f o and f 1 about x 77 x x 0 x n general Taylor series expansion about x: + --------------- fx fx x xf 1 x x + x+ ----------------- f! x + Ox x 3 Now evaluate f o fx o using te Taylor series f o fx xf 1 x + x + --------------------f x + Ox o x 3 However since x -- f o fx -- f 1 x + ---- f 8 x + O 3 p. 14.7
Similarly f 1 fx + -- f 1 x + ---- f 8 x + O 3 Let s substitute in for fx, f o and f 1 into te expression for E E fx x xf 1 x x + x + ----------------- f! x+ Ox x 3 dx x 0 --------------- fx --f 1 x+ ---- f 8 x+ O 3 fx -- f 1 + + x+ ---- f 8 x + O 3 E fxx x x ----------------- f 1 x x + x+ ----------------- 3 f 6 x + Ox x 4 -------------------- fx + ---- f 4 x + O 3 p. 14.8
E fx x --------------------f 1 x + x --------------------f 1 x x 3 + --------------------f 6 x x 3 --------------------f 6 x+ Ox 1 x 4 + Ox o x 4 E x fx -------------------- 8 f 1 x+ --------------------O 3 ----f 8 1 x ---- f 8 1 x -----f 3 48 x -----f 3 48 x O 4 + + + ---- 3 f 8 x + O 4 Notes E 3 Higer order terms ave been truncated in tis error expression. Tis integration will be exact only for ----- f 1 x linear. However it is tird order accurate in Error evaluation procedure using T.S. applies to iger order metods as well fx p. 14.9
Extended Trapezoidal Rule Apply trapezoidal rule to multiple sub-intervals 78 f 0 f 1 f f i f N f(x) a x 0 x x i b x N x ntegrate eac sub-interval wit trapezoidal rule and sum Split ab into N equispaced sub-intervals wit Compute as: b a ----------- N b + f x dx fx dx a N 1 i 0 x i 1 x i p. 14.10
--------------- fo + f x --------------- 1 f1 + f x N x N 1 + + + ----------------------- fn 1 + f N + E ab -- f 0 + f 1 + f + + f N 1 + f E N + ab were f o fa f 1 fa + f fa +... f i fa + i Tus extended trapezoidal rule can be expressed as: N 1 -- fa + fb + fa + i were N i 1 b a ----------- p. 14.11
Error is simply te sum of te individual errors: were te average x witin eac sub-interval Defining te average of te second derivatives Tus x i E a b Error is nd order over te interval - ----- 1 3 f 1 E a b i 1 Tus te error over te interval decreases as. Te slope of error vs. on a log-log plot is. N x i 1 ----- b a 1 1 --- f N f 1 E a b N --- f N i 1 x i 1 ----- b a 1 f a b N i 1 x i p. 14.1
Romberg ntegration Uses extended trapezoidal rule wit two or more different integration point to integration point spacings (in tis case equal to te sub-interval spacing),, in conjunction wit te general form of te error in order to compute one or more terms in te series wic represents te error. Tis will ten result in a iger order estimate of te integrand. More importantly, it will allow us to easily derive an error estimate for te numerical integrations based on te results using te different grid spacings. Consider were te exact integrand, Ĩ + E ab Ĩ te approximate integral wit integration point to integration point spacing E ab te associated error. Ĩ -- fa b a ----------- 1 + fb + fa + i i 1 p. 14.13
n general te form of te error term if we ad worked out more terms in te error series. E ab C + D 4 + E 6 + O 8 Notes Te coefficient C ----- 1 b af 1 n general, C, D, E etc. are functions of te average of te various derivatives of over te interval of interest. f Tese coefficients are not dependent on te spacing. Also we do not worry about te exact form of tese coefficients. As far as we are concerned, tey are unknown constant coefficients over te interval a b. p. 14.14
Tus te integral Ĩ + C + D 4 + E 6 + O 8 Unknowns: te exact integral; CDE te coefficients of te error term. Knowns: Ĩ te approximation to te integral; te integration point spacing. We must generate equations to solve for some of te unknowns Solve for and C. Tis will improve te accuracy of to O 4! Two unknowns must ave two equations use two different integration point to integration point spacings. Ĩ 1 + C 1 + D 4 1 + E 6 1 + O 1 8 Ĩ + C + D 4 + E 6 + O 8 p. 14.15
We now ave two equations and can terefore solve for unknowns. te exact integral is unknown: C te leading coefficient of te error term is unknown. We can solve for and C. We can not solve for equations! D, E,... and te oter coefficients since we do not ave enoug We must select 1 and suc tat a b is divided into an integer number of sub-intervals. Let 1 base interval We compute te approximation to te integral twice. Ĩ Ĩ p. 14.16
Tus Ĩ + 4C + 16D 4 + 64E 6 + Ĩ + C + D 4 + E 6 + Two equations and unknowns. Tus we can solve for bot and C. O 8 O 8 Ĩ 4C 16D 4 64E 6 + O 8 4 4Ĩ + 4C + 4D 4 + 4E 6 + O 8 4Ĩ Ĩ ------------------------ 4 D 3 4 0E 6 + O 8 Terefore if you ave second order accurate approximations to Ĩ using Ĩ using You can extrapolate a 4t order accurate approximation using te above formula. p. 14.17
More importantly, we can estimate te errors for bot te coarse and te fine integration point solutions simply by solving for C using te simultaneous equations C Ĩ Ĩ -------------------- 5D + O 4 3 Tus te estimated error associated wit te coarse integration point spacing solution, using te coarse and fine integration point spacing solutions is, E ab 4 -- Ĩ 3 Ĩ + O 4 Te estimated error associated wit te fine integration point spacing solution, using te coarse and fine integration point spacing solutions is, E ab 1 -- Ĩ 3 Ĩ + O 4 p. 14.18
Example Consider: 8 0 5x ------- 4 4 x 8 3 + x + 1 dx ntegrating exactly 7 Let s integrate numerically fx 5x ------- 4 4 x 8 3 + x + 1 a 0 b 8 Apply extended trapezoidal rule using: 8 (using one interval of 8) 4 (using two intervals of 4) Apply te Romberg integration rule we derived wen two integral estimates were obtained using intervals and to obtain a fourt order estimate for te integral Estimate te errors associated wit te extended trapezoidal rule results p. 14.19
Applying 8 (using one interval of 8) 8 0 ----------- 1 Ĩ -------- fa + fb + f0 + i i 1 Ĩ 4 f0+ f8 + f0 + i Since te index i runs from 1 to 0, we do not evaluate te summation term. Tus 0 i 1 Ĩ 41 + 59 Ĩ 10 p. 14.0
Applying 4 (using two intervals of 4) 8 0 ----------- 1 Ĩ ---- fa + fb + fa + i i 1 Ĩ f0+ f8+ f0 + 4i 1 i 1 Ĩ f0 + f8+ f4 Ĩ 1 + 59+ 87 Ĩ 71 p. 14.1
We can obtain an O 4 accurate answer using te O trapezoidal rule results, Ĩ and Ĩ 4Ĩ Ĩ ----------------------- + O 3 4 4 71 10 ----------------------------------- + O 3 4 4.6667 + O 4 We can also estimate te error associated wit te two O trapezoidal rule results, Ĩ and Ĩ Let s estimate te error for te trapezoidal rule result wit 8 E ab estimated 4 -- Ĩ 3 Ĩ + O 4 4 -- 71 10 1877.33 3 Note tat te actual error for te trapezoidal rule results wit 8 p. 14.
E ab actual Ĩ 7 10 048. Let s estimate te error for te trapezoidal rule results wit 4 E ab estimated 1 -- Ĩ 3 Ĩ + O 4 1 -- 71 10 469.33 3 Note tat te actual error for te trapezoidal rule results wit 4 equals E ab actual Ĩ 7 71 640. Romberg ntegration Using 3 Estimates of te ntegral Let s consider using tree estimates on Ĩ 1 + C 1 + D 4 1 + E 6 1 + O 1 8 Ĩ + C + D 4 + E 6 + O 8 p. 14.3
Ĩ 3 + C 3 + D 4 3 + E 6 3 + O 3 8 Tree equations we can solve for tree unknowns: Solve for exact integral and and D coefficients of te first two terms in te error series! C Terefore we can now derive an O 6 accurate approximation to Apply integration point spacings:, and 1 3 ----. Estimates of te integral are related to te exact integral,, as: Ĩ + 4C + 16D 4 + 64E 6 + O 8 Ĩ + C + D 4 + E 6 + O 8 C Ĩ --- D 4 ----- 4 E + + 16 + ----- 6 64 + O 8 We can solve for te unknowns, C and D! ---- p. 14.4
1 ----- 64Ĩ 45 ---- 0Ĩ + Ĩ E + 6 + O 8 SUMMARY OF LECTURE 14 Trapezoidal rule is simply applying linear interpolation between two points and integrating te approximating polynomial. Error for Trapezoidal Rule Te error can be determined by computing ex dx if ex is expressed in series form. Te error can also be determined by Taylor series expansions of te integration formula and te exact integral. Extended trapezoidal rule applies piecewise linear approximations and sums up individual integrals. Error for extended trapezoidal rule is obtained simply by adding errors over all subintervals p. 14.5
Romberg ntegration Uses trapezoidal rule wit different intervals. Extrapolates a better answer by estimating te error. Tis can be a muc more efficient process tan increasing te number of intervals. Romberg ntegration can be applied to any of te integration metods we will develop p. 14.6