Topic 6a Numerical Integration

Similar documents
Lecture Outline. Scattering From a Dielectric Slab Anti Reflection Layer Bragg Gratings 8/9/2018. EE 4347 Applied Electromagnetics.

Lecture Outline. Scattering at an Impedance Discontinuity Power on a Transmission Line Voltage Standing Wave Ratio (VSWR) 8/10/2018

MATH 1014 Tutorial Notes 8

1.4 Techniques of Integration

Multiple Integrals. Introduction and Double Integrals Over Rectangular Regions. Philippe B. Laval KSU. Today

Math 42: Fall 2015 Midterm 2 November 3, 2015

Multiple Integrals. Introduction and Double Integrals Over Rectangular Regions. Philippe B. Laval. Spring 2012 KSU

Riemann Sum Comparison

(x + 3)(x 1) lim(x + 3) = 4. lim. (x 2)( x ) = (x 2)(x + 2) x + 2 x = 4. dt (t2 + 1) = 1 2 (t2 + 1) 1 t. f(x) = lim 3x = 6,

5.2 LENGTHS OF CURVES & AREAS OF SURFACES OF REVOLUTION

7.1 Indefinite Integrals Calculus

4.9 APPROXIMATING DEFINITE INTEGRALS

Lecture Outline. Scattering at an Interface Sunrises & Sunsets Rainbows Polarized Sunglasses 8/9/2018. EE 4347 Applied Electromagnetics.

Lecture 28 The Main Sources of Error

Math 425 Notes 9. We state a rough version of the fundamental theorem of calculus. Almost all calculations involving integrals lead back to this.

Math 122 Fall Unit Test 1 Review Problems Set A

Synthesizing Geometries for 21st Century Electromagnetics

Precalculus Summer Assignment 2015

t 2 + 2t dt = (t + 1) dt + 1 = arctan t x + 6 x(x 3)(x + 2) = A x +

Variational Methods & Optimal Control

Project One: C Bump functions

First Order Differential Equations

Lecture Outline. Attenuation Coefficient and Phase Constant Characteristic Impedance, Z 0 Special Cases of Transmission Lines

Numerical Implementation of Transformation Optics

Integration TERMINOLOGY. Definite integral: The integral or primitive function restricted to a lower

Integration Using Tables and Summary of Techniques

MEI Core 1. Basic Algebra. Section 1: Basic algebraic manipulation and solving simple equations. Manipulating algebraic expressions

Mark Scheme (Results) January 2007

Assume that you have made n different measurements of a quantity x. Usually the results of these measurements will vary; call them x 1

Math Precalculus I University of Hawai i at Mānoa Spring

Chapter 4 Integration

2.2 Separable Equations

Lecture Outline. Shorted line (Z L = 0) Open circuit line (Z L = ) Matched line (Z L = Z 0 ) 9/28/2017. EE 4347 Applied Electromagnetics.

Section 1.1 Algorithms. Key terms: Algorithm definition. Example from Trapezoidal Rule Outline of corresponding algorithm Absolute Error

dt 2 The Order of a differential equation is the order of the highest derivative that occurs in the equation. Example The differential equation

March 4, 2019 LECTURE 11: DIFFERENTIALS AND TAYLOR SERIES.

Numerical Integration

Math Final Exam Review

Solution. This is a routine application of the chain rule.

AP Calculus AB Integration

Distance and Velocity

AP Calculus AB 2nd Semester Homework List

MATH 312 Section 2.4: Exact Differential Equations

7.5 Proportionality Relationships

Lecture 21: Numerical Solution of Differential Equations

6 Lecture 6b: the Euler Maclaurin formula

Π xdx cos 2 x

4.1 Analysis of functions I: Increase, decrease and concavity

Chapter 6 Section Antiderivatives and Indefinite Integrals

SOLUTIONS TO EXAM II, MATH f(x)dx where a table of values for the function f(x) is given below.

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

Math 165 Final Exam worksheet solutions

Math 122 Fall Handout 15: Review Problems for the Cumulative Final Exam

Numerical integration

AB Calculus Diagnostic Test

Week 2 Techniques of Integration

X. Numerical Methods

Review. The derivative of y = f(x) has four levels of meaning: Physical: If y is a quantity depending on x, the derivative dy

We saw in Section 5.1 that a limit of the form. arises when we compute an area.

Polynomials. Eve Rawley, (EveR) Anne Gloag, (AnneG) Andrew Gloag, (AndrewG)

AP Calculus AB. Integration. Table of Contents

worked out from first principles by parameterizing the path, etc. If however C is a A path C is a simple closed path if and only if the starting point

Math Numerical Analysis Mid-Term Test Solutions

8.3 Numerical Quadrature, Continued

Name Class. (a) (b) (c) 4 t4 3 C

Lecture Outline. Maxwell s Equations Predict Waves Derivation of the Wave Equation Solution to the Wave Equation 8/7/2018

The total error in numerical differentiation

MATH745 Fall MATH745 Fall

MHF4U. Advanced Functions Grade 12 University Mitchell District High School. Unit 2 Polynomial Functions 9 Video Lessons

AP Calculus AB. Slide 1 / 175. Slide 2 / 175. Slide 3 / 175. Integration. Table of Contents

Basic Fraction and Integer Operations (No calculators please!)

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

is a surface above the xy-plane over R.

Probability Foundation for Electrical Engineers Prof. Krishna Jagannathan Department of Electrical Engineering Indian Institute of Technology, Madras

Ordinary Differential Equations

1.8. Integration using Tables and CAS

EDEXCEL NATIONAL CERTIFICATE UNIT 4 MATHEMATICS FOR TECHNICIANS OUTCOME 4 TUTORIAL 1 - INTEGRATION

MA 262, Spring 2018, Midterm 1 Version 01 (Green)

EXAMPLES OF PROOFS BY INDUCTION

See animations and interactive applets of some of these at. Fall_2009/Math123/Notes

Mathematical Economics: Lecture 2

MATH 2413 TEST ON CHAPTER 4 ANSWER ALL QUESTIONS. TIME 1.5 HRS.

MATH Max-min Theory Fall 2016

8.6 Partial Fraction Decomposition

Infinite series, improper integrals, and Taylor series

Physics 411: Homework 3

MITOCW MITRES_18-007_Part5_lec3_300k.mp4

On Cauchy s theorem and Green s theorem

4B. Line Integrals in the Plane

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

9.4 CALCULUS AND PARAMETRIC EQUATIONS

Math 240 Calculus III

Section September 6, If n = 3, 4, 5,..., the polynomial is called a cubic, quartic, quintic, etc.

1 Review of di erential calculus

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

Calculus II Study Guide Fall 2015 Instructor: Barry McQuarrie Page 1 of 8

A DEEPER LOOK AT USING FUNCTIONS IN MATHEMATICA

One important way that you can classify differential equations is as linear or nonlinear.

Numerical techniques to solve equations

HOMEWORK 8 SOLUTIONS

Transcription:

Course Instructor Dr. Raymond C. Rumpf Office: A 337 Phone: (915) 747 6958 E Mail: rcrumpf@utep.edu Topic 6a umerical Integration EE 4386/5301 Computational Methods in EE Outline Introduction Discrete Integration Trapezoidal Integration Simpson s Integration Multiple Integrals Convergence 1

Introduction 3 Why Use umerical Integration? How to we calculate the following integral? b x e dx a o analytical solution exists to perform this integration by hand. We are forced to calculate the integration by other means. 4

Discrete Integration 5 Problem Setup Suppose we have a function f(x) and we want to integrate it from a to b. b a f x dx 6 3

Solution (1 of ) When we solve this problem on a computer, we will most likely only know the function value at discrete points. 7 Solution ( of ) A simple approach to approximate this integral is to represent the area under this function as a series of rectangles. Observe that the position of the points are at the center of the rectangles. b a ba ba f xdx f xnx f xn x n1 n1 x 8 4

Error Approximating the integral this way produces some error. Gaps between the true curve and the rectangles leads to error. 9 Reducing the Errors The only way to reduce error is to use thinner rectangles. However, this increases the number of computations that have to be performed which increases calculation time and could lead to larger round off error. Or, use a different numerical integration technique altogether! 10 5

Trapezoidal Integration 11 Problem Setup Suppose we have a function f(x) and we want to integrate it from a to b. b a f x dx 1 6

Solution (1 of ) A more accurate technique for numerical integration uses the trapezoidal rule. For this, we place the points x n differently. Points are placed at the extreme ends and distributed evenly. 13 Solution ( of ) Instead of fitting rectangles under the curve, we use trapezoids. This conforms more closely to the curve. 14 7

Error Approximating the integral this way still produces some error. There is noticeably less error than with discrete integration. E 1 t x f x ba 1 The error for trapezoidal integration is 3 15 Formulation (1 of ) The total area of a trapezoid is f x A 1 1 x x f f baseheight tri 1 1 f x 1 widthheight A x x f rect 1 1 x1 x Total Area of Trapezoid A Arect At ri 1 f f x x x x f x x f f 1 1 Slide 16 1 1 1 1 8

Formulation ( of ) In trapezoidal integration, we add all of the areas of the trapezoids to approximate the integration. b a f x n1 x dx x n1 n1 x f n n f f n n1 f n1 nonuniform spacing uniform spacing Slide 17 Uniform Spacing When the spacing is uniform, trapezoidal integration reduces to b a x f x dx fn f n1 n 1 To understand this more deeply, we expand the summation over four trapezoids. n1 f f f f f f f f f f n n1 1 3 3 4 4 5 We see that each point is included twice, except the two endpoints at x = a and x = b. n1 f f f f f f f n n1 1 3 4 5 Slide 18 9

Discrete Vs. Trapezoidal Integration (1 of ) There are some key differences between discrete and trapezoidal integration: Points are distributed differently. Discrete integration is easier to implement. Trapezoidal integration has less error. Trapezoidal more elegantly handles nonuniform spacing. Discrete Integration Trapezoidal Integration 19 Discrete Vs. Trapezoidal Integration ( of ) Let s compare the equations for both discrete and trapezoidal integration. First, we can rearrange trapezoidal integration as follows: b a x f x dx fn f x f f f f f 0.5 0.5 n1 n1 1 3 4 5 The equivalent equation for discrete integration is b a f x dx x f x f f f f n1 n 1 3 4 We see that trapezoidal integration reduces to discrete integration but with one extra rectangle added. 0 10

Interpreting Trapezoidal Integration as Discrete Integration Trapezoidal integration can be written as b a x f x dx fn f x f f f f f 0.5 0.5 n1 n1 1 3 4 5 This can be interpreted as a modified discrete integration. 1 How Can Discrete & Trapezoidal Produce Roughly the Same Error? egative Error Positive Error Positive and negative error tend to cancel within a segment. 11

Simpson s Integration 3 Simpson s 1/3 Rule Suppose we have three adjacent points and we fit them to a second order polynomial. f x a a x a x 0 1 ow let s integrate the polynomial under the curve. x3 x3 0 1 f x dx a a x a x dx x1 x1 1 x f 4 f f 3 1 3 To implement Simpson s 1/3 rule, we simply apply this to f(x) in groups of 3 points. Slide 4 1

Derivation of Simpson s 1/3 Rule First, fit the three points to a polynomial. f x a a x a x 0 1 f f f f f a f a a x x 3 1 3 1 0 1 x 0 x Second, integrate the polynomial from x to x. x 1 1 3 3 3 a 3 0 a1xax dxa0x a1x ax a0x a x x x x Substitute in the expressions for a 0, a 1, and a. f f f 1 a x a x x x x f f f 3 3 x 3 3 4 3 3 1 0 f 1 3 Slide 5 Implementation of Simpson s 1/3 Rule Animation of umerical Integration Using Simpson s 1/3 Rule Slide 6 13

Simpson s 3/8 Rule This is similar to Simpson s 1/3 rule, except we apply it to f(x) in groups of 4 points. x4 x1 3 f x dx x f f f f 8 3 3 1 3 4 Slide 7 Multiple Integrals 8 14

Problem Setup Suppose we have a function f(x,y) with two independent variables. How do we evaluate a double integral? xb yd xa yc f x, y dxdy? We will view this as an integral of integrals. xb xa yd yc f x, ydy dx? We evaluate the inside integral for each step of in the integration of the outside integral. Slide 9 Illustration of umerical Double Integration We start with a D array. We numerically integrate each of the columns to get a 1D array. We numerically integrate the 1D array. Our final answer is the numerical double integral of the original D array. Slide 30 15

Via Discrete Integration This is very easy using discrete integration. Our discrete equation is xb yd M xa yc b a x M d c y,, f x y dxdy f a mx c ny xy m0 n0 The MATLAB code to do this is simply dx = (b - a)/m; dy = (d - c)/; I = sum(f(:))*dx*dy; Slide 31 Convergence 3 16

What is Convergence? Convergence is the tendency of a numerical algorithm to approach a specific value as the resolution of the algorithm is increased. This does OT imply the answer gets more correct. There may still be something wrong with your calculation! Slide 33 Demonstration of Convergence Suppose we wish to evaluate the following integral: sin xdx 0 How many segments are necessary? There is no way to tell. We must perform a convergence study! Slide 34 17

Analytical Answer To check ourselves, we can solve the integral analytically 0 sin xdx cos x 0 cos cos 0 Slide 35 Convergence Study Slide 36 18

Convergence Study It is up to you to decide when a numerical algorithm is sufficiently converged. Perhaps convergence happens here if only a rough estimate is needed. Perhaps convergence happens here if higher precision is needed. Slide 37 Convergence Does OT Imply Correctness Sometimes we get lazy and say that algorithms get more accurate with higher resolution. THIS IS OT CORRECT!!! Algorithms can only become better converged. Less Correct? More Correct Slide 38 19

Rule of Thumb for Resolution For calculations involving waves, the resolution begins to converge when you resolve one wave cycle with about 10 divisions. wavelength 10 Slide 39 0