Numerical integration of a function known only through data points



Similar documents
Lesson 3. Numerical Integration

MATHEMATICS FOR ENGINEERING INTEGRATION TUTORIAL 3 - NUMERICAL INTEGRATION METHODS

7.6 Approximation Errors and Simpson's Rule

FACTORING QUADRATICS and 8.1.2

Math 1526 Consumer and Producer Surplus

10.1. Solving Quadratic Equations. Investigation: Rocket Science CONDENSED

1 Shapes of Cubic Functions

POLYNOMIAL FUNCTIONS

x 2 + y 2 = 1 y 1 = x 2 + 2x y = x 2 + 2x + 1

The Method of Partial Fractions Math 121 Calculus II Spring 2015

Estimating the Average Value of a Function

FACTORING QUADRATICS through 8.1.4

6 EXTENDING ALGEBRA. 6.0 Introduction. 6.1 The cubic equation. Objectives

AP CALCULUS AB 2008 SCORING GUIDELINES

PLOTTING DATA AND INTERPRETING GRAPHS

Graphical Integration Exercises Part Four: Reverse Graphical Integration

MA107 Precalculus Algebra Exam 2 Review Solutions

Year 9 set 1 Mathematics notes, to accompany the 9H book.

APPLICATIONS AND MODELING WITH QUADRATIC EQUATIONS

Piecewise Cubic Splines

Definition 8.1 Two inequalities are equivalent if they have the same solution set. Add or Subtract the same value on both sides of the inequality.

Section 9: Applied Optimization

Tennessee Department of Education

MSLC Workshop Series Math Workshop: Polynomial & Rational Functions

Algebra II A Final Exam

Math 1B, lecture 5: area and volume

ALGEBRA. Find the nth term, justifying its form by referring to the context in which it was generated

Excel Basics By Tom Peters & Laura Spielman

Algebra I Teacher Notes Expressions, Equations, and Formulas Review

Session 7 Bivariate Data and Analysis

3.2. Solving quadratic equations. Introduction. Prerequisites. Learning Outcomes. Learning Style

4.3 Lagrange Approximation

The GED math test gives you a page of math formulas that

Solving Quadratic Equations

Pigeonhole Principle Solutions

Graphing Quadratic Functions

Polynomial and Rational Functions

Review of Fundamental Mathematics

Example 1: Suppose the demand function is p = 50 2q, and the supply function is p = q. a) Find the equilibrium point b) Sketch a graph

Sect Solving Equations Using the Zero Product Rule

CALCULATIONS & STATISTICS

Vieta s Formulas and the Identity Theorem

Solving Quadratic & Higher Degree Inequalities

CURVE FITTING LEAST SQUARES APPROXIMATION

FREE FALL. Introduction. Reference Young and Freedman, University Physics, 12 th Edition: Chapter 2, section 2.5

GelAnalyzer 2010 User s manual. Contents

Polynomial Degree and Finite Differences

M Polynomial Functions 1

Grade 7/8 Math Circles November 3/4, M.C. Escher and Tessellations

MD5-26 Stacking Blocks Pages

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

Chapter 10. Key Ideas Correlation, Correlation Coefficient (r),

Introduction to Quadratic Functions

Math 115 Extra Problems for 5.5

Grade 7/8 Math Circles Fall 2012 Factors and Primes

Answer: C. The strength of a correlation does not change if units change by a linear transformation such as: Fahrenheit = 32 + (5/9) * Centigrade

1. Kyle stacks 30 sheets of paper as shown to the right. Each sheet weighs about 5 g. How can you find the weight of the whole stack?

MATHEMATICS FOR ENGINEERING BASIC ALGEBRA

Unit 7 Quadratic Relations of the Form y = ax 2 + bx + c

Definitions 1. A factor of integer is an integer that will divide the given integer evenly (with no remainder).

Algebra: Real World Applications and Problems

chapter >> Consumer and Producer Surplus Section 1: Consumer Surplus and the Demand Curve

SOLVING EQUATIONS WITH RADICALS AND EXPONENTS 9.5. section ( )( ). The Odd-Root Property

Investigating Area Under a Curve

physics 111N work & energy

Introduction to MATLAB IAP 2008

Greatest Common Factor and Least Common Multiple

3 e) x f) 2. Precalculus Worksheet P Complete the following questions from your textbook: p11: # Why would you never write 5 < x > 7?

or, put slightly differently, the profit maximizing condition is for marginal revenue to equal marginal cost:

the points are called control points approximating curve

The Theory and Practice of Using a Sine Bar, version 2

GAP CLOSING. Volume and Surface Area. Intermediate / Senior Student Book

LAB 11: MATRICES, SYSTEMS OF EQUATIONS and POLYNOMIAL MODELING

The aerodynamic center

PERIMETER AND AREA. In this unit, we will develop and apply the formulas for the perimeter and area of various two-dimensional figures.

Determine If An Equation Represents a Function

Microeconomics Sept. 16, 2010 NOTES ON CALCULUS AND UTILITY FUNCTIONS

ax 2 by 2 cxy dx ey f 0 The Distance Formula The distance d between two points (x 1, y 1 ) and (x 2, y 2 ) is given by d (x 2 x 1 )

Solids. Objective A: Volume of a Solids

7.7 Solving Rational Equations

Roots, Linear Factors, and Sign Charts review of background material for Math 163A (Barsamian)

Characteristics of the Four Main Geometrical Figures

Area Under the Curve. Riemann Sums And the Trapezoidal Rule

COLLEGE ALGEBRA. Paul Dawkins

Describing Relationships between Two Variables

Mean, Median, Standard Deviation Prof. McGahagan Stat 1040

AP Physics 1 and 2 Lab Investigations

ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates

Binomial Probability Distribution

3.2 The Factor Theorem and The Remainder Theorem

Calibration and Linear Regression Analysis: A Self-Guided Tutorial

Solving Geometric Applications

Geometry Notes VOLUME AND SURFACE AREA

MATH 60 NOTEBOOK CERTIFICATIONS

2. Select Point B and rotate it by 15 degrees. A new Point B' appears. 3. Drag each of the three points in turn.

7.2 Quadratic Equations

The Distance Formula and the Circle

The KaleidaGraph Guide to Curve Fitting

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

Numerical Solution of Differential

Transcription:

Numerical integration of a function known only through data points Suppose you are working on a project to determine the total amount of some quantity based on measurements of a rate. For example, you might measure the rate of flow of water at certain times and use these to determine the total amount of water that flowed. Or, you might record the speed of an airplane at certain times and try to figure out the total distance traveled. In cases such as this, the total quantity is given by the integral of the rate, and we can think of it as the area under a graph of the rate as a function of time. Suppose you collect data points on the rate at times,,,..., 9. These are displayed in the table at the right; the x values are the times, and the y values are the rates you measure. You believe that these data are points from a nice smooth function, but you only have the data points, not the function itself. Even so, you could imagine graphing the data points and then drawing smooth curves through them to define a function f, as in the figure below. The total quantity that you are trying to determine is equal to the area under the function f. The question is: how do you use the data points to approximate the area under f without knowing anything more about f than the data points you have? x y.... 7. 8. 9. 7 8 9 Left hand rectangles One way to approximate the area under the graph is to approximate the region under the graph by rectangles and add up the areas of the rectangles. Using the data points as the upper left corners of the rectangles leads to these left hand rectangles: 7 8 9

It s easy to add up the areas of the rectangles by hand, since they all have width (notice that the last data point is not used): L = +. + + +. =.9 On the other hand, the tops of the rectangles don t look like a smooth function through the data points, so the area under those horizontal lines won t be exactly the area under the function we have in mind. Right hand rectangles You can just as well use the data points to define the upper right corners of the rectangles. The graph looks slightly different: 7 8 9 The total area of all the rectangles is different too (here we don t use the first data point): R =. + + +. +. =. Trapezoids If we simply connected the data points with straight lines, the function that would give you looks a lot more like the function we have in mind: 7 8 9 The regions below the straight lines here are trapezoids, and it s not hard to calculate and add up the areas of the trapezoids, because the area of a trapezoid is the width times the average of the heights on the left and on the right, so the total area of the trapezoids is: T = +. +. + + +. +. =. It happens that this is the average of the left rectangle value L and the right rectangle value R: T = L + R =.9 +. =.

You can see this by mentally adding together the expressions for L and R above and dividing by. Trapezoid areas split the difference You can also see it by drawing left hand rectangles and right hand rectangles together with the trapezoids. The area of each trapezoid splits the difference (or averages) between the areas of the left hand and right hand rectangles. In many calculus classes, one learns how to calculate the area below a parabola exactly. We can use this idea to get a better approximation of the area. First, imagine connecting data points,, by a parabola through the points, and think about the area below that parabola. Then connect data points,, with another parabola, and so on. This results in a smoother version of a function through the data points: 7 8 9 Parabolas 7 8 9 Fortunately, after some work with calculus, one can get a nice formula for the area under each parabola. The area under the first parabola is: and the area under the four parabolas is: P = +. + A = +. + + +. +. + =.

General formulas In general, we have a table of data like the one shown at the right. Suppose the x values are evenly spaced. We can calculate the areas of left hand rectangles, right hand rectangles, trapezoids, area under one parabola, and area under all parabolas using these formulas: x y x y x y x y x y. x n. y n L = (x x )(y + y + + y n ) R = (x x )(y + y + + y n ) T = (x x )(y + y + y + + y n + y n )/ A = (x x )(y + y + y )/ P = (x x )(y + y + y + y + + y n + y n + y n )/ The coefficients,,,..., in the trapezoid calculation come from the fact that each y value besides the first and the last comes up twice in the calculation. The coefficients,,,,,...,,, in the parabola calculation come up because of the coefficient of on the middle y value in each parabola and the fact that y values that are common to two parabolas come up twice in the calculation. An easy way to keep track of the coefficients is to organize them into a table like the one below. Notice that the left hand rectangles use all the data points except the last one. The right hand rectangles skip the first data point but use all the rest. The trapezoids use all the data points, but give larger weight to the middle data points, since they have coefficients of. The parabola method uses all the data points, but weights the middle data points differently, and so is slightly more complicated. x y Left Right Trapezoid Parabola x y x y x y x y x y...... x n y n x n y n x n y n

Calculating areas on the TI-8/TI-8 It is easy to put the data points into a graphing calculator and get the calculator to compute the areas of the rectangles, trapezoids, or parabolas. Use STAT, EDIT, and enter the data under lists L and L, then the coefficients under L, L, L, and L. For our example, it looks like this: L L L L L L.... 7. 8. 9. You need to have an odd number of data points in order to use the areas below parabolas; this is the only way the,,,,...,,, pattern will work out. You can have the calculator add things up with the commands below. To type them in, do LIST, MATH, sum(, then LIST L, *, etc. Left: Right: Trapezoids: Parabolas: sum(l * L)*(x-x) sum(l * L)*(x-x) sum(l * L)*(x-x)/ sum(l * L)*(x-x)/ You need to calculate the difference x-x by hand, but it s not hard, because the spacing between the x values of the data points is always the same. Of course, you don t need to type in lists L, L, and L if you are just going to use the area under parabolas. You can also use Excel to do these calculations. Accuracy of the calculations Finally, a note about the accuracy of these calculations. When the function f is constant (a rare case!), the left hand and right hand rectangles give the exact area. When the function f is constant or linear, the trapezoids give the exact area. But when the function f is constant, linear, quadratic or even cubic, the parabola calculation gives the exact area. So the parabola calculation is exact for a wider collection of functions, and this is the main reason to recommend using it when the function you have in mind really is smooth, even though it is slightly more complicated. Using parabolas to find the area below a function is called Simpson s method. Cubic splines You might wonder where the smooth function in the very first graph came from. It is a cubic spline fit to the data points using the Matlab spline function. Using this function might give an even better approximation of the area under the actual function f, but you need to have access to a method for determining the best cubic spline. The area under the cublic spline is approximately.878.