11. Numerical Differentiation and Integration 11

Slides:



Advertisements
Similar presentations
6. 4 Integration with tables and computer algebra systems 6
Advertisements

Numerical Integration
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
Computational Methods in Physics PHYS 3437
Mathematics1 Mathematics 1 Applied Informatics Štefan BEREŽNÝ.
Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s.
Numerical Integration of Functions
NUMERICAL DIFFERENTIATION AND INTEGRATION
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Chapter 7 Numerical Differentiation and Integration
Today’s class Romberg integration Gauss quadrature Numerical Methods
Numerical Integration
Numerical Integration
Lecture 3: Integration. Integration of discrete functions
MANE 4240 & CIVL 4240 Introduction to Finite Elements Numerical Integration in 1D Prof. Suvranu De.
Numerical Integration
CISE301_Topic7KFUPM1 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM Read Chapter 21, Section 1 Read Chapter 22, Sections 2-3.
CISE301_Topic71 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM (Term 101) Section 04 Read Chapter 21, Section 1 Read Chapter.
Quadrature Greg Beckham. Quadrature Numerical Integration Goal is to obtain the integral with as few computations of the integrand as possible.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
19.5 Numeric Integration and Differentiation
Simpson’s 1/3 rd Rule of Integration. What is Integration? Integration The process of measuring the area under a.
Lecture 28: Comparison of different numerical integrators 1.Adaptive Simpson’s and Trapezoid Rules 2. Romberg Integration 3. Adaptive Gaussian Quadrature.
Chapter 4 Numerical Differentiation and Integration 1/16 Given x 0, approximate f ’(x 0 ). h xfhxf xf h )()( lim)('    x0x0 x1x1 h x1x1 x0x0.
1 NUMERICAL INTEGRATION Motivation: Most such integrals cannot be evaluated explicitly. Many others it is often faster to integrate them numerically rather.
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
SE-280 Dr. Mark L. Hornick Numerical Integration.
3. Numerical integration (Numerical quadrature) .
Lecture 19 - Numerical Integration CVEN 302 July 22, 2002.
Numerical Integration Pertemuan 7 Matakuliah: S0262-Analisis Numerik Tahun: 2010.
Numerical Computation
1 Chapter 7 NUMERICAL INTEGRATION. 2 PRELIMINARIES We use numerical integration when the function f(x) may not be integrable in closed form or even in.
Numerical Differential & Integration. Introduction If a function f(x) is defined as an expression, its derivative or integral is determined using analytical.
1 Simpson’s 1/3 rd Rule of Integration. 2 What is Integration? Integration The process of measuring the area under a curve. Where: f(x) is the integrand.
Chapters 5 and 6: Numerical Integration
4.6 Numerical Integration Trapezoid and Simpson’s Rules.
4.6 Numerical Integration. The Trapezoidal Rule One method to approximate a definite integral is to use n trapezoids.
1 Numerical Integration Section Why Numerical Integration? Let’s say we want to evaluate the following definite integral:
1 Trapezoidal Rule of Integration. What is Integration Integration: The process of measuring the area under a function.
MA2213 Lecture 4 Numerical Integration. Introduction Definition is the limit of Riemann sums I(f)
EE3561_Unit 7Al-Dhaifallah EE 3561 : Computational Methods Unit 7 Numerical Integration Dr. Mujahed AlDhaifallah ( Term 342)
Integration Copyright © Cengage Learning. All rights reserved.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 22.
5. Integration 2.Quadrature as Box Counting 3.Algorithm: Trapezoid Rule 4.Algorithm: Simpson’s Rule 5.Integration Error 6.Algorithm: Gaussian Quadrature.
Chap. 11 Numerical Differentiation and Integration
Use of Newton-Cotes Formulas and eventual shortcomings Matlab code to increase number of segments with trapezoid, 1/3 and 3/8 rule.
The purpose of Chapter 5 is to develop the basic principles of numerical integration Usefule Words integrate, integral 积分(的), integration 积分(法), quadrature.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 5 Integration and Differentiation.
Chapters 5 and 6: Numerical Integration Code development trapezoid rule Simpson’s rule Gauss quadrature Laguerre quadrature Analysis changing the variable.
3/12/ Trapezoidal Rule of Integration Computer Engineering Majors Authors: Autar Kaw, Charlie Barker
SE301_Topic 6Al-Amer20051 SE301:Numerical Methods Topic 6 Numerical Integration Dr. Samir Al-Amer Term 053.
Lecture 19 Approximating Integrals. Integral = “Area”
Approximating Antiderivatives. Can we integrate all continuous functions? Most of the functions that we have been dealing with are what are called elementary.
Quadrature – Concepts (numerical integration) Don Allen.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions.
Copyright © Cengage Learning. All rights reserved.
Chapter 22.
Chapter 7 Numerical Differentiation and Integration
NUMERICAL INTEGRATION
Copyright © Cengage Learning. All rights reserved.
Composite Numerical Integration
Numerical Integration:
Copyright © Cengage Learning. All rights reserved.
Numerical Computation and Optimization
SKTN 2393 Numerical Methods for Nuclear Engineers
Simpson’s 1/3rd Rule of Integration
Numerical Integration
Romberg Rule of Integration
Numerical Integration
Presentation transcript:

11. Numerical Differentiation and Integration 11 11. Numerical Differentiation and Integration 11.3 Better Numerical Integration, 11.4 Gaussian Quadrature, 11.5 MATLAB’s Methods Natural Language Processing Lab Dept. of Computer Science and Engineering, Korea Univertity CHOI Won-Jong (wjchoi@nlp.korea.ac.kr) Woo Yeon-Moon(wooym@nlp.korea.ac.kr) Kang Nam-Hee(nhkang@nlp.korea.ac.kr)

Contents 11.3 BETTER NUMERICAL INTEGRATION 11.3.1 Composite Trapezoid Rule 11.3.2 Composite Simpson’s Rule 11.3.3 Extrapolation Methods for Quadrature 11.4 GAUSSIAN QUADRATURE 11.4.1 Gaussian Quadrature on [-1, 1] 11.4.2 Gaussian Quadrature on [a, b] 11.5 MATLAB’s Methods

11.3.1 Composite Trapezoid Rule 11.3.2 Composite Simpson’s Rule CHOI WonJong (wjchoi@nlp.korea.ac.kr)

11.3.1 Composite Trapezoid Rule CHOI WonJong (wjchoi@nlp.korea.ac.kr)

11.3 BETTER NUMERICAL INTEGRATION Composite integration(복합적분) : Applying one of the lower order methods presented in the previous section repeatedly on several sub intervals.

11.3.1 Composite Trapezoid Rule If we divide the interval of integration, [a, b], into two or more subintervals and use the trapezoid rule on each subintervals, we obtain the composite trapezoid rule.

11.3.1 Composite Trapezoid Rule If we divide the interval into n subintervals, we get MATLAB CODE

11.3.1 Composite Trapezoid Rule Example 11.9 n=1 n=2 n=3 n=4 n=20 n=100

11.3.1 Composite Trapezoid Rule Example 11.9

11.3.2 Composite Simpson’s Rule CHOI WonJong (wjchoi@nlp.korea.ac.kr)

11.3.2 Composite Simpson’s Rule Example 11.10

11.3.2 Composite Simpson’s Rule Applying the same idea of subdivision of intervals to Simpson’s rule and requiring that n be even gives the composite Simpson rule. [a,b]를 two subintervals [a,x2], [x2, b]로 나눈다면,

11.3.2 Composite Simpson’s Rule In general, for n even, we have h=(b-a)/n, and Simpson’s rule is

11.3.2 Composite Simpson’s Rule Example 11.10

11.3.2 Composite Simpson’s Rule Example 11.11 Length of Elliptical Orbit

11.3.2 Composite Simpson’s Rule Example 11.11 Length of Elliptical Orbit days 0 10 20 30 40 50 60 70 80 90 100 r = [0.00 1.07 1.75 2.27 2.72 3.14 3.56 4.01 4.53 5.22 6.28] Using Composite Simpson’s Rule and the length between day 0 and 10 (n=20) is 0.88952. (Trapezoid=0.889567, Text=0.8556) Using Composite Simpson’s Rule and the length between day 60 and 70 (n=20) is 0.382108. (Trapezoid=0.382109, Text=0.3702) The former is 2.3279 times faster than the latter.

11.3.3 Extrapolation Methods for Quadrature Woo Yeon-Moon(wooym@nlp.korea.ac.kr)

Richardson Expolation Truncation error(절단 오차) 사다리꼴 simpson

Richardson Expolation To obtain an estimate that is more accurate using two or more subintervals (h를 줄임) 그러나, 세부구간의 수가 일정한 범위를 넘어서면 round-off error가 커지게 된다. Richardson Extrapolation 간격이 다른 2개의 식을 구한 결과를 대수적으로 정리함으로써 보다 정확한 값을 산출 계산오차 세부 구간의 수 simpson trapezoid

Richardson Extrapolation Richardson Extrapolation using the trapezoid rule (if h_2 = ½ h_1) Simpson rules

Example 11.12 Integral of 1/x start with one subinterval (h=1) two subintervals (h=1/2) to apply Richardson extrapolation exact value of the integral is ln(2)=0.693147..

Example 11.12 Integral of 1/x Form a table of the approximations 0.6944 ≠0.693147 Ⅰ Ⅱ h=1 0.7500 0.6944 h=1/2 0.7083

Romberg Integration Approximate an Error Trapezoid rules : Richardson extrapolation : continued ( using simpson rules)

Romberg Integration Improving the result by Richardson extrapolation Romberg integration : iterative procedure using Richardson extrapolation k means the improving level(= ) 1st 2nd 3rd

Example 11.12 Integral of 1/x using Romberg Integration Trapezoid rule For k=0, I_0 = 0.75 For k=1, I_1 = 0.7083 For k=2, I_2 = 0.6941 To apply Richardson extrapolation Ⅰ Ⅱ h=1 0.7500 0.6944 0.6933 0.6943 h=1/2 0.7083 h=1/4 0.6970 h=1/8 0.6941

Example 11.12 Integral of 1/x using Romberg Integration second level of extrapolation Ⅰ Ⅱ Ⅲ h=1 0.7500 0.6944 0.6933 h=1/2 0.7083 [16(0.6933)-0.6944]/15 h=1/4 0.6970

Example 11.12 Integral of 1/x using Romberg Integration five levels of extrapolation to find values for 0.7500 0.6944 0.6932 0.6931 0.7083 0.6933 0.6970 0.6941 0.6934

Matlab function for Romberg Integration

11.4 Gaussian Quadrature Kang Nam-Hee (nhkang@nlp.korea.ac.kr)

11.4.1 Gaussian Quadrature on [-1,1] Gaussian Quadrature Formular Get the definite integration of f(x) on [-1,1] using linear combinations of coefficient ck and evaluated function value f(xk) at the point xk Appropriate values of the points xk and ck depend on the choice of n By choosing the quadrature point x1 ,… xn as the n zeros of the nth-degree Gauss-Legendre polynomial, and by using the appropriate coefficients, the integration formular is exact for polynomials of degree up to 2n-1

11.4.1 Gaussian Quadrature on [-1,1] Gaussian Quadrature Formular (cont.) n=2 n=3

11.4.1 Gaussian Quadrature on [-1,1] Example 11.13 integral of exp(-x2) Using G.Q n Xi ci 2 3 4 ±0.557753 ±0.77459 ±0.861136 ±0.339981 1 8/9 5/9 0.34785 0.652145 Table 11.2 parameters of Gaussian quadrature

11.4.1 Gaussian Quadrature on [-1,1] Gaussian-Legendre Polynomials

11.4.2 Gaussian Quadrature on [a,b] Extends Gaussian Quadrature for f(t) on [a, b]  by Transformation f(t) on [a, b] to f(x) on [-1,1] For the given integral change interval of t by using next formular so the interval

11.4.2 Gaussian Quadrature on [a,b] Extends Gaussian Quadrature for f(t) on [a, b] (cont.) f(t) rewrite for variable x remark the factor (b-a)/2 (∵td convert to dx) Apply f(x) to the integral

11.4.2 Gaussian Quadrature on [a,b] Example 11.14 integral of exp(-x2) on [0,2] using G.Q with n = 2 Consider again the integral Transform f(t) on [0,2] to f(x) on [-1,1] using next formular

11.4.2 Gaussian Quadrature on [a,b] Example 11.14 (cont) So we can get Apply Gaussian Quadrature to the integral with n = 2

11.4.2 Gaussian Quadrature on [a,b] Matlab function for Gaussian Quadrature

11.5 MATLAB’s Methods Woo Yeon-Moon(wooym@nlp.korea.ac.kr)

11.5 MATLAB’s Methods p=polyfit(x,y,n) – find the coefficients of the polynomial of degree n polyder(p) - calculates the derivative of polynomials diff(x) - x = [1 2 3 4 5]; y = diff(x) y = 1 1 1 1 traps(x,y) Q=quad(‘f’,xmin,xmax) (simpson rules) Q=quad8(‘f’,xmin,xmax) (Newton-Cotes eight-panel rule)