Numerical Computation

Slides:



Advertisements
Similar presentations
ES 240: Scientific and Engineering Computation. Chapter 17: Numerical IntegrationIntegration  Definition –Total area within a region –In mathematical.
Advertisements

1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s.
Numerical Integration
CHAPTER 4 THE DEFINITE INTEGRAL.
Chapter 17 Numerical Integration Formulas. Graphical Representation of Integral Integral = area under the curve Use of a grid to approximate an integral.
Chapter 5 Integrals 5.2 The Definite Integral In this handout: Riemann sum Definition of a definite integral Properties of the definite integral.
1 Example 2 Estimate by the six Rectangle Rules using the regular partition P of the interval [0,  ] into 6 subintervals. Solution Observe that the function.
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_Topic7KFUPM1 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM Read Chapter 21, Section 1 Read Chapter 22, Sections 2-3.
1 Example 1 (a) Estimate by the Midpoint, Trapezoid and Simpson's Rules using the regular partition P of the interval [0,2] into 6 subintervals. (b) Find.
CISE301_Topic71 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM (Term 101) Section 04 Read Chapter 21, Section 1 Read Chapter.
Integrals 5.
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.
3. Numerical integration (Numerical quadrature) .
Lecture 19 - Numerical Integration CVEN 302 July 22, 2002.
Numerical Integration Pertemuan 7 Matakuliah: S0262-Analisis Numerik Tahun: 2010.
MAT 1235 Calculus II Section 7.7 Approximate (Numerical) Integration
The Definite Integral.
4.6 Numerical Integration -Trapezoidal Rule -Simpson’s Rule
Introduction to Numerical Analysis I
Lecture 19 – Numerical Integration 1 Area under curve led to Riemann sum which led to FTC. But not every function has a closed-form antiderivative.
Chapters 5 and 6: Numerical Integration
4.6 Numerical Integration. The Trapezoidal Rule One method to approximate a definite integral is to use n trapezoids.
Wicomico High School Mrs. J. A. Austin AP Calculus 1 AB Third Marking Term.
Integration. Antiderivatives and Indefinite Integration.
Georg Friedrich Bernhard Riemann
Homework questions thus far??? Section 4.10? 5.1? 5.2?
EE3561_Unit 7Al-Dhaifallah EE 3561 : Computational Methods Unit 7 Numerical Integration Dr. Mujahed AlDhaifallah ( Term 342)
Integration Copyright © Cengage Learning. All rights reserved.
5.2 Definite Integrals. Subintervals are often denoted by  x because they represent the change in x …but you all know this at least from chemistry class,
CHAPTER 4 SECTION 4.2 AREA.
Section 4.3 – Riemann Sums and Definite Integrals
1 §12.4 The Definite Integral The student will learn about the area under a curve defining the definite integral.
Learning Objectives for Section 13.4 The Definite Integral
Section 5.9 Approximate Integration Practice HW from Stewart Textbook (not to hand in) p. 421 # 3 – 15 odd.
The Definite Integral.
1 Example 1 Estimate by the six Rectangle Rules using the regular partition P of the interval [0,1] into 4 subintervals. Solution This definite integral.
1. Does: ? 2. What is: ? Think about:. Finding Area between a Function & the x-axis Chapters 5.1 & 5.2 January 25, 2007.
Chapter 6 Integration Section 4 The Definite Integral.
Section 4.3 Day 1 Riemann Sums and Definite Integrals AP Calculus BC.
Warm up 10/16 (glue in). Be seated before the bell rings DESK homework Warm-up (in your notes) Agenda : go over hw Finish Notes lesson 4.5 Start 4.6.
Chapters 5 and 6: Numerical Integration Code development trapezoid rule Simpson’s rule Gauss quadrature Laguerre quadrature Analysis changing the variable.
Chapter 6 Integration Section 5 The Fundamental Theorem of Calculus (Day 1)
SE301_Topic 6Al-Amer20051 SE301:Numerical Methods Topic 6 Numerical Integration Dr. Samir Al-Amer Term 053.
Definite Integral df. f continuous function on [a,b]. Divide [a,b] into n equal subintervals of width Let be a sample point. Then the definite integral.
Section 4.3 Day 2 Riemann Sums & Definite Integrals AP Calculus BC.
Definite Integrals & Riemann Sums
4.3: Definite Integrals Learning Goals Express the area under a curve as a definite integral and as limit of Riemann sums Compute the exact area under.
Definite Integrals, The Fundamental Theorem of Calculus Parts 1 and 2 And the Mean Value Theorem for Integrals.
4.3 Riemann Sums and Definite Integrals
Quadrature – Concepts (numerical integration) Don Allen.
[5-4] Riemann Sums and the Definition of Definite Integral Yiwei Gong Cathy Shin.
NUMERICAL DIFFERENTIATION Forward Difference Formula
Lecture 19 – Numerical Integration
Midpoint and Trapezoidal Rules
NUMERICAL INTEGRATION
Area and the Definite Integral
5. 7a Numerical Integration. Trapezoidal sums
Area and the Definite Integral
The Area Question and the Integral
Copyright © Cengage Learning. All rights reserved.
5. 7a Numerical Integration. Trapezoidal sums
Copyright © Cengage Learning. All rights reserved.
Numerical Integration
6.2 Definite Integrals.
Objectives Approximate a definite integral using the Trapezoidal Rule.
Presentation transcript:

Numerical Computation Lecture 16: Numerical Integration United International College

Last Time During the last class period we covered: Numerical Approximations to Derivatives Readings: Pav, Chapter 7

Today We will cover: Numerical Integration (Quadrature) Readings: Pav, Chapter 8, sections 8.1-8.3 Moler,

The Definite Integral The definite integral is the total value or summation of f(x) over a range of x. The integration symbol is actually a stylized capital S intended to signify the connection between integration and summation.

The Definite Integral f(x) a b x

Upper, Lower Sums We approximate the definite integral by splitting the interval from a to b into n subintervals a = x0 < x1 < x2 < . . . < xn-1 < xn = b This is called a partition P of [a,b]. On each subinterval [xi-1 ,xi ] define the smallest value of f(x) to be mi and the largest value of f(x) to be Mi . mi = min{ f(x) | xi-1 < x < xi } Mi = max{ f(x) | xi-1 < x < xi }

Upper, Lower Sums Then, we can define Lower and Upper approximating sums for the integral:

Upper, Lower Sums Definition: A function f(x) is Riemann-integrable over [a,b] if over all possible partitions P. Here the words “sup” and “inf” can be thought of as the same as maximum and minimum. Theorem (from calculus): If f(x) is continuous on [a,b], then it is Riemann-integrable on [a,b]

Upper, Lower Sums Note: While this is a good definition, in practice it is often hard to find the max and min of f(x) on each subinterval. Idea: Use a simpler approximation that is between the Upper and Lower approximations.

Simple Trapezoidal Rule Over a single interval [a,b] we can approximate f(x) by a line and find the area under this line. This area looks like a trapezoid.

Simple Trapezoidal Rule The area under this trapezoid is just

Composite Trapezoidal Rule To get a better approximation for f(x) over [a,b] we create a partition with equal sized subintervals: a = x0 < x1 < x2 < . . . < xn-1 < xn = b with the width of every subinterval = h. That is, xi+1 - xi = h for all i. Adding up all the trapezoidal areas we get

Composite Trapezoidal Rule Factoring out the h we get This is the Composite Trapezoidal Rule

Composite Trapezoidal Rule Example: Approximate using the composite trapezoidal rule with n=4. Solution: h = (2-0)/4 = ½. Partition is 0 < 0.5 < 1.0 < 1.5 < 2.0 Trapezoidal Rule gives

Error in Trapezoidal Rule Theorem: (Section 8.2.1 in Pav) Proof: (Read section 8.2.1 in Pav) Note: The trapezoidal rule will be exact (no error) if the function f(x) is linear. (Why?)

Simple Midpoint Rule The area defined by a rectangle of height f((a+b)/2) is a (a+b)/2 b

Composite Midpoint Rule Create a partition: a = x0 < x1 < x2 < . . . < xn-1 < xn = b with the width of every subinterval = h. Adding up all the midpoint areas we get This is the Composite Midpoint Rule

Simple Simpson’s Rule Instead of using linear approximations to f(x), we can use a 2nd order Lagrange polynomial approximation L(x). To do this, we will need three points, a,b, and x1 halfway between a and b. L(x) f(x) a=x0 c=x1 b=x2

Simple Simpson’s Rule The area under L(x) can be an approximation to the integral

Simple Simpson’s Rule After integrating and simplifying we get

Composite Simpson’s Rule Create a partition with an even number of subintervals: a = x0 < x1 < x2 < . . . < xn-1 < xn = b with the width of every subinterval = h. On every pair of subintervals, [x0 , x1], [x1 , x2 ], etc, we use Simpson’s Rule: f(x) …... x x0 h x1 h x2 h x3 h x4 xn-2 xn-1 xn

Composite Simpson’s Rule We get:

Composite Simpson’s Rule Simplifying, we have This is the Composite Simpson’s Rule Note: The error in Simpson’s rule is O(h4)

Matlab – Trapezoidal Rule function sum = trapezoid( f, a, b, n ) % trapezoid computes the trapezoidal rule % approximation to f(x) over [a,b] using n % equally spaced subintervals h = (b-a)/n; x = a + (h .* (0:n)); % vector of partition x values sum=0.0; for i = 1:n sum = sum + (h/2.0)*(f(x(i)) + f(x(i+1))); end

Matlab – Trapezoidal Rule >> trapezoid(inline('x^2'),1,2,64) ans = 2.3334

Romberg Integration Idea: Use the Richardson Extrapolation technique to improve integral approximations. Consider the Trapezoidal Rule using 2n subintervals of [a,b]. Then, h = (b-a)/ 2n and the approximation will be We know that this approximation has error O(h2). Thus,

Romberg Integration This is exactly the kind of expression we had for Richardson Extrapolation in Chapter 7. Let

Romberg Intergation Compute the table of values: This is called Romberg Integration

Romberg Intergation Example: Approximate The exact value =

Romberg Intergation Note: In the column for m=1 we have If we calculate this out, we get exactly the Simpson’s Rule approximations for the integral.