數值方法 2008, Applied Mathematics NDHU 1 Simpson rule Composite Simpson rule.

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

ES 240: Scientific and Engineering Computation. Chapter 17: Numerical IntegrationIntegration  Definition –Total area within a region –In mathematical.
數值方法 2008, Applied Mathematics NDHU 1 Nonlinear systems Newton’s method The steepest descent method.
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
A Riemann sum is a method for approximating the total area underneath a curve on a graph. This method is also known as taking an integral. There are 3.
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
數值方法 2008, Applied Mathematics NDHU 1 Spline interpolation.
Numerical Integration Lecture (II)1
Newton-Cotes Integration Formula
Chapter III. Numerical Integration for Ship Forms Review of CVEN 302.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Numerical Differentiation and Integration ~ Newton-Cotes.
NUMERICAL DIFFERENTIATION The derivative of f (x) at x 0 is: An approximation to this is: for small values of h. Forward Difference Formula.
CISE301_Topic71 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM (Term 101) Section 04 Read Chapter 21, Section 1 Read Chapter.
Numerical Integration Simpson’s Method. Trapezoid Method & Polygonal Lines One way to view the trapezoid method for integration is that the curves that.
Simpson’s 1/3 rd Rule of Integration. What is Integration? Integration The process of measuring the area under a.
Numerical Integration In general, a numerical integration is the approximation of a definite integration by a “weighted” sum of function values at discretized.
Lecture 28: Comparison of different numerical integrators 1.Adaptive Simpson’s and Trapezoid Rules 2. Romberg Integration 3. Adaptive Gaussian Quadrature.
Area of a single trapezoid = h
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.
Numerical Integration
Numerical Integration Approximating Definite Integral.
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.
1 Numerical Analysis Lecture 12 Numerical Integration Dr. Nader Okasha.
D MANCHE Finding the area under curves:  There are many mathematical applications which require finding the area under a curve.  The area “under”
4.6 Numerical Integration -Trapezoidal Rule -Simpson’s Rule
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.
Introduction to Numerical Analysis I
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.
CSE 330 : Numerical Methods
1 Numerical Integration Section Why Numerical Integration? Let’s say we want to evaluate the following definite integral:
數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.
數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.
Integration Copyright © Cengage Learning. All rights reserved.
Integration For a function f, The “integral of f from a to b” is the area under the graph of the function. If f is continuous, then the area is well defined,
數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration.
Section 5.9 Approximate Integration Practice HW from Stewart Textbook (not to hand in) p. 421 # 3 – 15 odd.
Chap. 11 Numerical Differentiation and Integration
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapter 21.
數值方法 2008 Applied Mathematics, NDHU1  Lagrange polynomial  Polynomial interpolation Lecture 4II.
數值方法 2008, Applied Mathematics NDHU1 Chaos time series.
數值方法 2008, Applied Mathematics NDHU 1 Numerical Differentiation.
Lesson 7-7 Numerical Approximations of Integrals -- What we do when we can’t integrate a function Riemann Sums Trapezoidal Rule.
Lecture 19 Approximating Integrals. Integral = “Area”
數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration.
Numerical Integration
NUMERICAL DIFFERENTIATION Forward Difference Formula
Part 6 - Chapter 21.
Chapter 7 Numerical Differentiation and Integration
Midpoint and Trapezoidal Rules
Numerical Analysis Lecture 42.
Lecture 5 Polynomial Approximation
5. 7a Numerical Integration. Trapezoidal sums
Integration Review Problems
Approximating Definite Integrals. Left Hand Riemann Sums.
Approximating Definite Integrals. Left Hand Riemann Sums.
5. 7a Numerical Integration. Trapezoidal sums
Copyright © Cengage Learning. All rights reserved.
Numerical Integration
Objectives Approximate a definite integral using the Trapezoidal Rule.
Numerical Integration
Presentation transcript:

數值方法 2008, Applied Mathematics NDHU 1 Simpson rule Composite Simpson rule

Simpson rule for numerical integration 數值方法 2008, Applied Mathematics NDHU 2

3 a=1.2;b=2; x=linspace(a,b);plot(x,sin(x));hold on y=sin(x) for x within [1.2 2]

數值方法 2008, Applied Mathematics NDHU 4 Quadratic polynomial c=0.5*(a+b); x=[a b c]; y=sin(x); p=polyfit(x,y,2); z=linspace(a,b); plot(z,polyval(p,z),'r') Approximate sin using a quadratic polynomial

數值方法 2008, Applied Mathematics NDHU 5 a=1;b=3; x=linspace(a,b);plot(x,sin(x)) hold on; c=0.5*(a+b); x=[a b c]; y=sin(x); p=polyfit(x,y,2); z=linspace(a,b); plot(z,polyval(p,z),'r') Approximate sin(x) within [1 3] by a quadratic polynomial

數值方法 2008, Applied Mathematics NDHU 6 a=1;b=3; x=linspace(a,b);plot(x,sin(x)) hold on; c=0.5*(a+b); x=[a b ]; y=sin(x); p=polyfit(x,y,1); z=linspace(a,b); plot(z,polyval(p,z),'r') Approximate sin(x) within [1 3] by a line

數值方法 2008, Applied Mathematics NDHU 7 Strategy I : Apply Trapezoid rule to calculate area under a line Strategy II : Apply Simpson rule to calculate area under a second order polynomial Strategy II is more accurate and general than strategy I, since a line is a special case of quadratic polynomial

Simpson rule  Original task: integration of f(x) within [a,b]  c=(a+b)/2  Numerical task  Approximate f(x) within [a,b] by a quadratic polynomial, p(x)  Integration of p(x) within [a,b] 數值方法 2008, Applied Mathematics NDHU 8

9 Blue: f(x)=sin(x) within [1,3] Red: a quadratic polynomial that pass (1,sin(1)), (2,sin(2)),(3,sin(3))

數值方法 2008, Applied Mathematics NDHU 10 The area under a quadratic polynomial is a sum of area I, II and III

數值方法 2008, Applied Mathematics NDHU 11 The area under a quadratic polynomial is a sum of area I, II and III Partition [a,b] to three equal-size intervals, and use the high of the middle point c to produce three Trapezoids Use the composite Trapezoid rule to determine area I, II and III h/2*(f(a)+f(c) +f(c)+f(c)+ f(c)+f(b)) substitute h=(b-a)/3 and c=(a+b)/2 area I + II + III = (b-a)/6 *(f(a)+4*f((a+b)/2) +f(b))

數值方法 2008, Applied Mathematics NDHU 12

數值方法 2008, Applied Mathematics NDHU 13

數值方法 2008, Applied Mathematics NDHU 14

數值方法 2008, Applied Mathematics NDHU 15

數值方法 2008, Applied Mathematics NDHU 16 Shift Lagrange polynomial Rescale Lagrange polynomial

數值方法 2008, Applied Mathematics NDHU 17 Shortcut to Simpson 1/3 rule 1.Partition [a,b] to three equal intervals 2.Draw three trapezoids, Q(I), Q(II) and Q(III) 3.Calculate the sum of areas of the three trapezoids

Proof 數值方法 2008, Applied Mathematics NDHU 18

Composite Simpson rule  Partition [a,b] into n interval  Integrate each interval by Simpson rule  h=(b-a)/2n 數值方法 2008, Applied Mathematics NDHU 19

Apply Simpson sule to each interval 數值方法 2008, Applied Mathematics NDHU 20

數值方法 2008, Applied Mathematics NDHU 21 Composite Simpson rule

數值方法 2008, Applied Mathematics NDHU 22 Set n Set fx h=(b-a)/(2*n) ans=0; for i=0:n-1 aa=a+2*i*h; cc=aa+h;bb=cc+h; ans=ans+h/3*(fx(aa)+4*fx(cc)+fx(bb)) exit

數值方法 2008, Applied Mathematics NDHU 23 Composite Simpson rule h=(b-a)/2n

數值方法 2008, Applied Mathematics NDHU 24 Composite Simpson rule h=(b-a)/2n Simpson's Rule for Numerical Integration