Presentation is loading. Please wait.

Presentation is loading. Please wait.

11. Numerical Differentiation and Integration 11

Similar presentations


Presentation on theme: "11. Numerical Differentiation and Integration 11"— Presentation transcript:

1 11. Numerical Differentiation and Integration 11
11. Numerical Differentiation and Integration 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 Woo Kang

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

3 11.3.1 Composite Trapezoid Rule 11.3.2 Composite Simpson’s Rule
CHOI WonJong

4 11.3.1 Composite Trapezoid Rule
CHOI WonJong

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

6 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.

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

8 11.3.1 Composite Trapezoid Rule
Example 11.9 n= n= n=3 n= n= n=100

9 11.3.1 Composite Trapezoid Rule
Example 11.9

10 11.3.2 Composite Simpson’s Rule
CHOI WonJong

11 11.3.2 Composite Simpson’s Rule
Example 11.10

12 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]로 나눈다면,

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

14 11.3.2 Composite Simpson’s Rule
Example 11.10

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

16 11.3.2 Composite Simpson’s Rule
Example Length of Elliptical Orbit days r = [ ] Using Composite Simpson’s Rule and the length between day 0 and 10 (n=20) is (Trapezoid= , Text=0.8556) Using Composite Simpson’s Rule and the length between day 60 and 70 (n=20) is (Trapezoid= , Text=0.3702) The former is times faster than the latter.

17 11.3.3 Extrapolation Methods for Quadrature
Woo

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

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

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

21 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)=

22 Example 11.12 Integral of 1/x Form a table of the approximations
h=1 0.7500 0.6944 h=1/2 0.7083

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

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

25 Example 11.12 Integral of 1/x using Romberg Integration
Trapezoid rule For k=0, I_0 = 0.75 For k=1, I_1 = For k=2, I_2 = 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

26 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) ]/15 h=1/4 0.6970

27 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

28 Matlab function for Romberg Integration

29 11.4 Gaussian Quadrature Kang Nam-Hee

30 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

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

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

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

34 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

35 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

36 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

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

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

39 11.5 MATLAB’s Methods Woo

40 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 = [ ]; y = diff(x) y = traps(x,y) Q=quad(‘f’,xmin,xmax) (simpson rules) Q=quad8(‘f’,xmin,xmax) (Newton-Cotes eight-panel rule)


Download ppt "11. Numerical Differentiation and Integration 11"

Similar presentations


Ads by Google