Riemann Sums. Outline. James K. Peterson. September 15, Riemann Sums. Riemann Sums In MatLab

Similar documents
Riemann Integration. Outline. James K. Peterson. February 2, Riemann Sums. Riemann Sums In MatLab. Graphing Riemann Sums

Riemann Integration. James K. Peterson. February 2, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

Lecture 5b: Starting Matlab

Integration by Parts Logarithms and More Riemann Sums!

An Introduction to Matlab

Antiderivatives! Outline. James K. Peterson. January 28, Antiderivatives. Simple Fractional Power Antiderivatives

Antiderivatives! James K. Peterson. January 28, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

Riemann Integration Theory

Newton s Cooling Model in Matlab and the Cooling Project!

Mathematical Induction

MAT137 - Term 2, Week 2

Derivatives and the Product Rule

Project Two. James K. Peterson. March 26, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

Project Two. Outline. James K. Peterson. March 27, Cooling Models. Estimating the Cooling Rate k. Typical Cooling Project Matlab Session

The Existence of the Riemann Integral

Solving systems of ODEs with Matlab

MA 137 Calculus 1 with Life Science Applications. (Section 6.1)

4.3. Riemann Sums. Riemann Sums. Riemann Sums and Definite Integrals. Objectives

Predator - Prey Model Trajectories are periodic

Hölder s and Minkowski s Inequality

Project One: C Bump functions

7.1 Indefinite Integrals Calculus

Regression and Covariance

Matrices and Vectors

The First Derivative and Second Derivative Test

The First Derivative and Second Derivative Test

Riemann Sums and Riemann Integrals

Predator - Prey Model Trajectories are periodic

Uniform Convergence Examples

Complex Numbers. James K. Peterson. September 19, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

Complex Numbers. Outline. James K. Peterson. September 19, Complex Numbers. Complex Number Calculations. Complex Functions

Linear Systems of ODE: Nullclines, Eigenvector lines and trajectories

A Simple Protein Synthesis Model

Hölder s and Minkowski s Inequality

Mathematical Induction Again

Differentiating Series of Functions

Mathematical Induction Again

Uniform Convergence Examples

Linear Systems of ODE: Nullclines, Eigenvector lines and trajectories

The Derivative of a Function

Cable Convergence. James K. Peterson. May 7, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

HW#2: Quads 7 #1 6. How do you find the answer to a Quadratic Inequality? 02Quad7 SolvingQuadraticInequalities Notes.notebook.

Bolzano Weierstrass Theorems I

Riemann Sums and Riemann Integrals

Advanced Protein Models

MAT137 - Term 2, Week 4

Day 2 Notes: Riemann Sums In calculus, the result of f ( x)

Defining Exponential Functions and Exponential Derivatives and Integrals

Predator - Prey Model Trajectories and the nonlinear conservation law

Advanced Protein Models

4 Integration. Copyright Cengage Learning. All rights reserved.

Relationship Between Integration and Differentiation

Solving Linear Systems of ODEs with Matlab

MA 1125 Lecture 15 - The Standard Normal Distribution. Friday, October 6, Objectives: Introduce the standard normal distribution and table.

General Power Series

Consequences of Continuity

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

Chapter 6: The Definite Integral

5.3 Definite Integrals and Antiderivatives

Convergence of Sequences

18A.1: #2,4,5 (Area under curve) 18A.2: #1 3 (Definite integral)

INTEGRATION: AREAS AND RIEMANN SUMS MR. VELAZQUEZ AP CALCULUS

Chapter 6 Section Antiderivatives and Indefinite Integrals

The SIR Disease Model Trajectories and MatLab

Variation of Parameters

RAMs.notebook December 04, 2017

Logarithm and Exponential Derivatives and Integrals

() Chapter 8 November 9, / 1

v(t) v(t) Assignment & Notes 5.2: Intro to Integrals Due Date: Friday, 1/10

More on infinite series Antiderivatives and area

Math Calculus I

Integration and Differentiation Limit Interchange Theorems

Lab 11: Numerical Integration Techniques. Figure 1. From the Fundamental Theorem of Calculus, we know that if we want to calculate f ( x)

9/4/2017. Motion: Acceleration

Why This Class? James K. Peterson. August 22, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

Consequences of Continuity

Integration. Antiderivatives and Indefinite Integration 3/9/2015. Copyright Cengage Learning. All rights reserved.

Integration. 2. The Area Problem

The Basics of Physics with Calculus Part II. AP Physics C

Integration. Copyright Cengage Learning. All rights reserved.

Taylor Polynomials. James K. Peterson. Department of Biological Sciences and Department of Mathematical Sciences Clemson University

1 Introduction; Integration by Parts

INTEGRATION: THE FUNDAMENTAL THEOREM OF CALCULUS MR. VELAZQUEZ AP CALCULUS

Math 122 Fall Unit Test 1 Review Problems Set A

More Protein Synthesis and a Model for Protein Transcription Error Rates

Proofs Not Based On POMI

PLEASE LET ME KNOW IF YOU FIND TYPOS (send to

Generating Function Notes , Fall 2005, Prof. Peter Shor

Substitutions and by Parts, Area Between Curves. Goals: The Method of Substitution Areas Integration by Parts

Fourier Series Code. James K. Peterson. April 9, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

CIS 2033 Lecture 5, Fall

The Definite Integral. Day 6 Motion Problems Strategies for Finding Total Area

t dt Estimate the value of the integral with the trapezoidal rule. Use n = 4.

Integration. Tuesday, December 3, 13

Sin, Cos and All That

Dirchlet s Function and Limit and Continuity Arguments

Fundamental Theorem of Calculus

Area. A(2) = sin(0) π 2 + sin(π/2)π 2 = π For 3 subintervals we will find

Evaluating Integrals (Section 5.3) and the Fundamental Theorem of Calculus (Section 1 / 15 (5.4

5.5. The Substitution Rule

Transcription:

Riemann Sums James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University September 15, 2013 Outline Riemann Sums Riemann Sums In MatLab

Abstract This lecture introduces Riemann sums and Riemann integrals. We talked earlier about the special limiting process that leads to a Riemann integral and we have gone over derivatives and antiderivatives of a wide class of functions. But we need desperately a connection between these ideas. We are going to find the easy way to calculate a Riemann integral. No limits at all! Here is the rule b f (t) dt = F (b) F (a) a where F is any antiderivative of f! All we have to do is guess one and we have had a lot of practice doing just that in the last chapter. Of course, this is not magic and it follows from careful reasoning. So get ready for a nice long read. Remember the punch line: this new tool helps us and understanding how a tool is made helps us master it. We must learn learn to make them do our bidding. So here we go with another step on your road to becoming craftsman.

Let s go back and be formal for a bit. To study the integration of a function f, there are two intellectually separate ideas: the primitive or antiderivative and the Riemann integral. They seem quite different, don t they? We have 1. the idea of a Primitive or Antiderivative: f. This is any function F which is differentiable and satisfies F (t) = f (t) at all points in the domain of f. Normally, the domain of f is a finite interval of the form [a, b], although it could also be an infinite interval like all of R or [1, ) and so on. Note that an antiderivative does not require any understanding of the process of Riemann integration at all only what differentiation is! 2. The idea of the Riemann integral of a function. Riemann integration is far more complicated to setup than the process of guessing a primitive or antiderivative. To define a Riemann integral properly, first, we start with a bounded function f on a finite interval [a, b]. This kind of function f need not be continuous! Then select a finite number of points from the interval [a, b], {t 0, t 1,,..., t n 1, t n}. We don t know how many points there are, so a different selection from the interval would possibly gives us more or less points. But for convenience, we will just call the last point t n and the first point t 0. These points are not arbitrary t 0 is always a, t n is always b and they are ordered like this: t 0 = a < t 1 < t 2 <... < t n 1 < t n = b The collection of points from the interval [a, b] is called a Partition of [a, b] and is denoted by some letter here we will use the letter P.

So if we say P is a partition of [a, b], we know it will have n + 1 points in it, they will be labeled from t 0 to t n and they will be ordered left to right with strict inequalities. But, we will not know what value the positive integer n actually is. The simplest Partition P is the two point partition {a, b}. Note these things also: 1. Each partition of n + 1 points determines n subintervals of [a, b] 2. The lengths of these subintervals always adds up to the length of [a, b] itself, b a. 3. These subintervals can be represented as {[t0, t1], [t1, t2],..., [tn 1, tn]} or more abstractly as [ti, ti+1] where the index i ranges from 0 to n 1. 4. The length of each subinterval is ti+1 ti for the indices i in the range 0 to n 1. 5. The largest subinterval length is called the norm of the partition and we denote it by the symbol P. Now from each subinterval [t i, t i+1] determined by the Partition P, select any point you want and call it s i. This will give us the points s 0 from [t 0, t 1], s 1 from [t 1, t 2] and so on up to the last point, s n 1 from [t n 1, t n]. At each of these points, we can evaluate the function f to get the value f (s j). Call these points an Evaluation Set for the partition P. Let s denote such an evaluation set by the letter E. If the function f was nice enough to be positive always and continuous, then the product f (s i) (t i+1 t i) can be interpreted as the area of a rectangle.

Then, if we add up all these rectangle areas we get a sum which is useful enough to be given a special name: the Riemann Sum for the function f associated with the Partition P and our choice of evaluation set E = {s 0,..., s n 1}. This sum is represented by the symbol S(f, P, E) where the things inside the parenthesis are there to remind us that this sum depends on our choice of the function f, the partition P and the evaluation set E. We have S(f, P, E) = n 1 f (s i) (t i+1 t i) i=0 Definition The Riemann sum for the bounded function f, the partition P and the evaluation set E = {s 0,..., s n 1} from P{t 0, t 1,,..., t n 1, t n} is defined by S(f, P, E) = n 1 f (s i) (t i+1 t i) i=0 It is pretty misleading to write the Riemann sum this way as it can make us think that the n is always the same when in fact it can change value each time we select a different P. So many of us write the definition this way instead S(f, P, E) = i P f (si) (ti+1 ti) and we just remember that the choice of P will determine the size of n.

Example Let s look at an example of all this. Here we see the graph of a typical function which is always positive on some finite interval [a, b]. (a, f (a)) (b, f (b)) A generic curve f on the interval [a, b] which is always positive. Note the area under this curve is the shaded region. a b Figure: The Area Under The Curve f Example Continued Next, let s set the interval to be [1, 6] and compute the Riemann Sum for a particular choice of Partition P and evaluation set E. The partition (gray) is P = {1.0, 1.5, 2.6, 3.8, 4.3, 5.6, 6.0}. Hence, we have subinterval lengths of t 1 t 0 = 0.5, t 2 t 1 = 1.1, t 3 t 2 = 1.2, t 4 t 3 = 0.5, t 5 t 4 = 1.3 and t 6 t 5 = 0.4, giving P = 1.3. For the evaluation set (red) E = {1.1, 1.8, 3.0, 4.1, 5.3, 5.8} the Riemann sum is S(f, P, E) = 5 f (s i) (t i+1 t i) i=0 = f (1.1) 0.5 + f (1.8) 1.1 + f (3.0) 1.2 + f (4.1) 0.5 + f (5.3) 1.3 + f (5.8) 0.4

Example Continued (1, f (1)) (6, f (6)) The partition points are in gray and the evaluation points are in red. 1 6 Figure: A Simple Riemann Sum Example Continued We can also interpret the Riemann sum as an approximation to the area under the curve. The partition (gray) is P = {1.0, 1.5, 2.6, 3.8, 4.3, 5.6, 6.0}. For the evaluation set (red) E = {1.1, 1.8, 3.0, 4.1, 5.3, 5.8} (1, f (1)) (6, f (6)) 1 6 Figure: The Riemann Sum As An Approximate Area

Example Example We let f (t) = t 2 + 6t 8 on the interval [2, 4] with P = {2, 2.5, 3.0, 3.7, 4.0} and E = {2.2, 2.8, 3.3, 3.8}. Solution The partition determines subinterval lengths of t 1 t 0 = 0.5, t 2 t 1 = 0.5, t 3 t 2 = 0.7, and t 4 t 3 = 0.3, giving P = 0.7. For E and P, we have the Riemann sum S(f, P, E) = 3 i=0 f (si) (ti+1 ti. Thus S(f, P, E) = f (2.2) 0.5 + f (2.8) 0.5 + f (3.3) 0.7 + f (3.8) 0.3 = 37.995 Example Example Let f (t) = 3t 2 on the interval [ 1, 2] with P = { 1, 0.3, 0.6, 1.2, 2.0} and E = { 0.7, 0.2, 0.9, 1.6}. Find the Riemann sum. Solution The partition determines subinterval lengths of t 1 t 0 = 0.7, t 2 t 1 = 0.9, t 3 t 2 = 0.6, and t 4 t 3 = 0.8, giving P = 0.9. For the evaluation set E the Riemann sum is S(f, P, E) = f ( 0.7) 0.7 + f (0.2) 0.9 + f (0.9) 0.6 + f (1.6) 0.8 = 8.739

Homework 24 For the given function f, partition P and evaluation set E, do the following. 1. Find S(f, P, E) for the partition P and evaluation set E. 2. Find P. 3. Sketch a graph of this Riemann sum as an approximation to the area under the curve f. Do a nice graph with appropriate use of color. Homework 24 Continued 24.1 Let f (t) = t 2 + 2 on the interval [1, 3] with P = {1, 1.5, 2.0, 2.5, 3.0} and E = {1.2, 1.8, 2.3, 2.8}. 24.2 Let f (t) = t 2 + 3 on the interval [1, 3] with P = {1, 1.6, 2.3, 2.8, 3.0} and E = {1.2, 1.9, 2.5, 2.85}. 24.3 Let f (t) = 3t 2 + 2t on the interval [1, 2] with P = {1, 1.2, 1.5, 1.8, 2.0} and E = {1.1, 1.3, 1.7, 1.9} 24.4 Let f (t) = 3t 2 + t on the interval [1, 4] with P = {1, 1.2, 1.5, 2.8, 4.0} and E = {1.1, 1.3, 2.3, 3.2}

Let s start with Riemann sums in Matlab. As you have seen, doing these by hand is tedious. Let s look at how we might do them using MatLab. Here is a typical MatLab session to do this. Let s calculate the Riemann sum for the function f (x) = x 2 on the interval [1, 3] using the partition P = {1, 1.5, 2.1, 2.8, 3.0} and evaluation set E = {1.2, 1.7, 2.5, 2.9}. First, set up our function. MatLab allows us to define a function inside the MatLab environment as follows >> f = @( x ) ( x. ˆ 2 ) ; This defines the function f (x) = x 2. If we had wanted to define g(x) = 2x 2 + 3, we would have used >> g = @( x ) ( 2 x. ˆ 2 + 3) ; To square X, we would write X.^2 to square each component creating a new vector with each entry squared. >> X. ˆ 2 ans = 1 4 9 The way we set up the function f = @(x) (x.^2); makes use of this. The variable X may or may not be a vector. So we write x.^2 so that if x is a vector, multiplication is done component wise and if not, it is just the squaring of a number. So for our function, to find f for all the values in X, we just type >> f (X) ans = 1 4 9

Now let s setup the partition with the command >> P = [ 1 ; 1. 5 ; 2. 1 ; 2. 8 ; 3. 0 ] P = 1. 0 0 0 0 1. 5 0 0 0 2. 1 0 0 0 2. 8 0 0 0 3. 0 0 0 0 The command diff in MatLab is applied to a vector to create the differences we have called the x i s. >> dx = d i f f (P) dx = 0. 5 0 0 0 0. 6 0 0 0 0. 7 0 0 0 0. 2 0 0 0 Next, we set up the evaluation set E. >> E = [ 1. 2 ; 1. 7 ; 2. 5 ; 2. 9 ] E = 1. 2 0 0 0 1. 7 0 0 0 2. 5 0 0 0 2. 9 0 0 0 Find f (E); a new vector with the values f (s i) s. Use f (E). dx to create the new vector with components f (s i) x i. >> g = f ( E ). dx g = 0. 7 2 0 0 1. 7 3 4 0 4. 3 7 5 0 1. 6 8 2 0

Finally, we add all these components together to get the Riemann sum. In MatLab, we add up the entries of a vector g with the command sum(g). >> RS = sum ( g ) RS = 8. 5 1 1 0 Without the comments, the MatLab session is not too long. >> f = @( x ) ( x. ˆ 2 ) ; >> P = [ 1 ; 1. 5 ; 2. 1 ; 2. 8 ; 3. 0 ] ; >> dx = d i f f (P) ; >> E = [ 1. 2 ; 1. 7 ; 2. 5 ; 2. 9 ] ; >> g = f ( E ). dx ; >> RS = sum ( g ) ; Homework 25 For the given function f, partition P and evaluation set E, do the following: use Matlab to find S(f, P, E) for the partition P and evaluation set E. Create a new word document for this homework. Do the document in single space. Do matlab fragments in bold font. The document starts with your name, MTHSC 106-Bio, Section Number, Date and Homework number.

Homework 25 Continued Then answer the problems like this: 1. State Problem 1. insert into your doc the matlab commands you use to solve the problem. Do this in bold. before each line of matlab add explanatory comments so we can check to see you know what you re doing. 2. State Problem 2. same stuff Homework 25 Example Jim Peterson MTHSC 106-B, Section Number today s date and HW Number, Problem 1: Let f (t) = sin(5t) on the interval [1, 3] with P = {1, 1.5, 2.0, 2.5, 3.0} and E = {1.2, 1.8, 2.3, 2.8}. Find S(f, P, E), % add e x p l a n a t i o n h e r e >> f = @( x ) s i n ( 5 x ) ; % add e x p l a n a t i o n h e r e >> P = [ 1 ; 1. 5 ; 2. 0 ; 2. 5 ; 3. 0 ] ; % add e x p l a n a t i o n h e r e >> E = [ 1. 2 ; 1. 8 ; 2. 3 ; 2. 8 ] ; % add e x p l a n a t i o n h e r e >> dx = d i f f (P) ; % add e x p l a n a t i o n h e r e >> g = f ( E ). dx ; % add e x p l a n a t i o n h e r e >> RS = sum ( g ) RS = 0. 1 2 3 9

Homework 25 Continued 25.1 Let f (t) = t 2 + 2 on the interval [1, 3] with P = {1, 1.5, 2.0, 2.5, 3.0} and E = {1.2, 1.8, 2.3, 2.8}. 25.2 Let f (t) = t 2 + 3 on the interval [1, 3] with P = {1, 1.6, 2.3, 2.8, 3.0} and E = {1.2, 1.9, 2.5, 2.85}. 25.3 Let f (t) = 3t 2 + 2t on the interval [1, 2] with P = {1, 1.2, 1.5, 1.8, 2.0} and E = {1.1, 1.3, 1.7, 1.9} 25.4 Let f (t) = 3t 2 + t on the interval [1, 4] with P = {1, 1.2, 1.5, 2.8, 4.0} and E = {1.1, 1.3, 2.3, 3.2}