Numerical Integra/on

Similar documents
Numerical Integra/on

Numerical Integration of Functions

Numerical Integration (Quadrature) Another application for our interpolation tools!

Extrapolation in Numerical Integration. Romberg Integration

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Chapter 5: Numerical Integration and Differentiation

Section 6.6 Gaussian Quadrature

Integration. Topic: Trapezoidal Rule. Major: General Engineering. Author: Autar Kaw, Charlie Barker.

LECTURE 14 NUMERICAL INTEGRATION. Find

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

Romberg Rule of Integration

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point

MA6452 STATISTICS AND NUMERICAL METHODS UNIT IV NUMERICAL DIFFERENTIATION AND INTEGRATION

APPM/MATH Problem Set 6 Solutions

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration.

Numerical Methods for Engineers. and Scientists. Applications using MATLAB. An Introduction with. Vish- Subramaniam. Third Edition. Amos Gilat.

Romberg Integration and Gaussian Quadrature

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 16. f(x) dx,

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Numerical Integration

8.3 Numerical Quadrature, Continued

Numerical Methods for Engineers

NUMERICAL INTEGRATION. By : Dewi Rachmatin

Outline. 1 Numerical Integration. 2 Numerical Differentiation. 3 Richardson Extrapolation

MA1023-Methods of Mathematics-15S2 Tutorial 1

12.0 Properties of orthogonal polynomials

Preface. 2 Linear Equations and Eigenvalue Problem 22

Do not turn over until you are told to do so by the Invigilator.

MA2501 Numerical Methods Spring 2015

COURSE Numerical integration of functions (continuation) 3.3. The Romberg s iterative generation method

Curve Fitting and Interpolation

Numerical Integration and Numerical Differentiation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Numerical Methods I: Numerical Integration/Quadrature

COURSE Numerical integration of functions

In numerical analysis quadrature refers to the computation of definite integrals.

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

Chapter 5 - Quadrature

Case Study Number 2: Pressure of Strip Load on Retaining Wall - Verifying Jarquio s Solution

3. Numerical Quadrature. Where analytical abilities end...

Chap. 19: Numerical Differentiation

Numerical Analysis. A Comprehensive Introduction. H. R. Schwarz University of Zürich Switzerland. with a contribution by

Numerical Methods with MATLAB

Scientific Computing: Numerical Integration

Answers to Homework 9: Numerical Integration

Simpson s 1/3 Rule Simpson s 1/3 rule assumes 3 equispaced data/interpolation/integration points

Interpolation. s(s 1)(s 2) Δ 3 f ! s(s 1) Δ 2 f 0 + 2! f(x s )=f 0 + sδf 0 +

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

LECTURE 16 GAUSS QUADRATURE In general for Newton-Cotes (equispaced interpolation points/ data points/ integration points/ nodes).

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

SKMM 3023 Applied Numerical Methods

Numerical Methods for Engineers

Computational methods of elementary particle physics

Then, Lagrange s interpolation formula is. 2. What is the Lagrange s interpolation formula to find, if three sets of values. are given.

Computational Methods

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Math 107H Fall 2008 Course Log and Cumulative Homework List

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations

Romberg Integration. MATH 375 Numerical Analysis. J. Robert Buchanan. Spring Department of Mathematics

Fundamental Numerical Methods for Electrical Engineering

n = 4: 0 2( ) (4 0) ( t 2.67%) 8

Physics 115/242 Romberg Integration

M.SC. PHYSICS - II YEAR

BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination December, 2015 BCS-054 : COMPUTER ORIENTED NUMERICAL TECHNIQUES

5 Numerical Integration & Dierentiation

Virtual University of Pakistan

Contents. I Basic Methods 13

BSM510 Numerical Analysis

The University of Western Ontario Faculty of Engineering DEPARTMENT OF CHEMICAL AND BIOCHEMICAL ENGINEERING

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20

AM205: Assignment 3 (due 5 PM, October 20)

Numerical Methods. King Saud University

Numerical Methods School of Mechanical Engineering Chung-Ang University

Applied Numerical Analysis

Differentiation and Integration

Numerical Methods. Scientists. Engineers

(x x 0 )(x x 1 )... (x x n ) (x x 0 ) + y 0.

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF MATHEMATICS ACADEMIC YEAR / EVEN SEMESTER QUESTION BANK

NUMERICAL METHODS FOR ENGINEERING APPLICATION

6 Lecture 6b: the Euler Maclaurin formula

ECE5340/6340: Homework 4 ANSWER KEY

Ch. 03 Numerical Quadrature. Andrea Mignone Physics Department, University of Torino AA

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

Multistage Methods I: Runge-Kutta Methods

Numerical Analysis. Introduction to. Rostam K. Saeed Karwan H.F. Jwamer Faraidun K. Hamasalh

19.4 Spline Interpolation

Numerical methods. Examples with solution

4. Numerical Quadrature. Where analytical abilities end... continued

Numerical Methods School of Mechanical Engineering Chung-Ang University

Project One: C Bump functions

School of Sciences Indira Gandhi National Open University Maidan Garhi, New Delhi (For January 2012 cycle)

Numerical Mathematics

MTH603 FAQ + Short Questions Answers.

Calculus of Variations Summer Term 2014

MATHEMATICAL METHODS INTERPOLATION

Transcription:

Numerical Integra/on

The Trapezoidal Rule is a technique to approximate the definite integral where For 1 st order: f(a) f(b) a b

Error Es/mate of Trapezoidal Rule Truncation error: From Newton-Gregory formula (interpolation with equally spaced data) where h = step size between data points

Error Es/mate of Trapezoidal Rule take the first order with error term and integrate Since the limits of integration: Then

Error Es/mate of Trapezoidal Rule For small h, it is assumed that the term approximately constant, then is

Example Use the trapezoidal rule to numerically integrate f(x) =0.2+2x + 90x 2 120x 3 + 25x 4 from a = 0 to b = 0.8.

Example Use the trapezoidal rule to numerically integrate f(x) =0.2+2x + 90x 2 120x 3 + 25x 4 from a = 0 to b = 0.8. Solution: The function values f(0) = 0.2 f(0.8) = 8.2 Can be substituted into the trapezoidal rule equation to get I =0.8 0.2+8.2 2 =3.36

Example The exact value of the integral is 5.5104, and the error is E t =5.5104 3.36 = 2.1504 which corresponds to a percent relative error of 39%.

Mul/ple- Applica/on Trapezoidal Rule Improving the accuracy of the trapezoidal rule is by dividing the integration interval from a to b into a number of segments and apply the method to each segment. Dividing the interval into equally spaced base points (x 0, x 1, x 2,, x n ), gives n segments of equal width h, where: The total integral: Substituting the trapezoidal rule for each interval yields:

Mul/ple- Applica/on Trapezoidal Rule Or in general form and the error is second derivative at point located at segment i

MATLAB Implementa/on Use Matlab s built-in function trapz to estimate the integral of the following equation using 5 segment trapezoidal rule f(x) =0.2+2x + 90x 2 120x 3 + 25x 4 from a = 0 to b = 0.8. Recall that the exact value of the integral is 5.5104.

MATLAB Implementa/on % Create a vector with 5 equal segments from 0 to 0.8 x = linspace(0, 0.8, 6); % Calculate the function y y = 0.2 + 2*x + 90*x.^2 120*x.^3 + 25*x.^4; % Use trapz to integrate the data points q = trapz(x,y); Running the code gives q = 5.4349. Hence the relative error with respect to the exact value is

MATLAB Implementa/on Now, create your own solver using Matlab to estimate the integral of the following equation with 5 segment trapezoidal rule f(x) =0.2+2x + 90x 2 120x 3 + 25x 4 from a = 0 to b = 0.8. Recall that the exact value of the integral is 5.5104.

MATLAB Implementa/on % Number of segments n = 5; % Integral limits lowerlimit = 0; upperlimit = 0.8; % Discretization into equally spaced segments x = linspace(lowerlimit,upperlimit,n+1); % Define function to integrate y = 0.2 + 2*x + 90*x.^2-120*x.^3 + 25*x.^4; % Trapezoidal formula A = sum(y(2:n)); M = 2*A; I = (upperlimit-lowerlimit)*(y(1)+m+y(end))/(2*n); disp(['estimation of the integral is ', num2str(i)]);

MATLAB Implementa/on Now, create your own solver using Matlab to estimate the integral of the following equation with 5 segment trapezoidal rule f(x) =0.2+2x + 90x 2 120x 3 + 25x 4 from a = 0 to b = 0.8. You must not use SUM built-in function, but create a syntax that mimics the sum function. Recall that the exact value of the integral is 5.5104.

MATLAB Implementa/on % Number of segments n = 5; % Integral limits lowerlimit = 0; upperlimit = 0.8; % Discretization into equally spaced segments x = linspace(lowerlimit,upperlimit,n+1); % Define function to integrate y = 0.2 + 2*x + 90*x.^2-120*x.^3 + 25*x.^4; % Trapezoidal formula A = 0; for i=2:n A = A + y(i); end M = 2*A; I = (upperlimit-lowerlimit)*(y(1)+m+y(end))/(2*n);

Simpson s 1/3 Rule uses second-order interpolating polynomial to approximate definite integrals where f 2 (x) is represented by a second-order Lagrange polynomial, hence a is designated as x 0 and b as x 2.

Or in compact form Simpson s 1/3 Rule and the truncation error where

Mul/ple- Applica/on Simpson s 1/3 Rule Simpson s 1/3 rule can be improved by dividing the integration interval into a number of segments of equal width: The total integral can be represented as: and the error: is as in previous slide

Simpson s 3/8 Rule uses a third-order Lagrange interpolating polynomial to approximate definite integrals. The total integral is expressed as and the error is as in previous slide.

Example Consider the function over the fixed interval Apply the various quadrature formulas to approximate integral of the function.

Example Consider the function over the fixed interval Apply the various quadrature formulas to approximate integral of the function. From substitution of the integral limits into f (x): For the trapezoidal rule,

For Simpson s 1/3 rule, Example For Simpson s 3/8 rule, For multiple application formulas, divide the integral limits into equally spaced points, such as, if n = 5, then

Example If we chose, then and the equally spaced points and their corresponding function values are For the multiple-application trapezoidal rule:

Example For the multiple-application Simpson s 1/3 rule:

Example To compute error estimate for the trapezoidal rule, the function s second derivative over the interval can be computed by differentiating the original functions twice to give: The average value of the second derivative: Use integration by parts to evaluate (see Improper Integrals)

Integra/on with Unequal Segments By applying the trapezoidal rule to each segment, the total integral for problems with unequal step sizes or segments is given by: where h i is the width of segment i.

Example Estimate the integral of spaced points with unequally and

Example Estimate the integral of spaced points with unequally and The exact value of the integration is 3.3333. The function values at each point are

Example Using the formula for integration with unequal segments: which represent an absolute relative error of

Romberg Integra/on This method uses Richardson extrapolation to approximate the definite integral Starting with the multiple application trapezoidal rule For estimates with halving the step size:

Romberg Integra/on To improve the estimates with higher accuracy, if the step size h is further halved

Example Use Romberg integration based on Richardson extrapolation to estimate the integral of with integration limits from a = 0 to b = 0.8.

Example Use Romberg integration based on Richardson extrapolation to estimate the integral of with integration limits from a = 0 to b = 0.8. (The exact value of the integral is For integration limits a = 0 and b = 0.8, the segment h is 0.8: Halving the segment, now we have:

Example The total integral: Relative error:

Adap/ve Quadrature is used for unequally spaced points: where

And the error Adap/ve Quadrature

is given by Gauss Quadrature The truncation error The weights a i are given by where the abscissas x i are the n zeros of the Legendre polynomial P n

Gauss Quadrature Legendre polynomials P n (x) is given by

Improper Integrals Given an improper integral or an integral with a nonregular integrand, such as with unbounded derivatives. Before using some numerical method (e.g., Simpson s formula), the integral may be transformed by substitution, integration by parts or series expansion, etc. Example: the substitution x = t 2 transforms the integrals to the regular forms

References Numerical Methods for Engineers, S.C. Chapra and R.P. Canale.