Integration by Parts Logarithms and More Riemann Sums!

Similar documents
Riemann Integration Theory

Lecture 5b: Starting Matlab

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

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

An Introduction to Matlab

Riemann Sums. Outline. James K. Peterson. September 15, Riemann Sums. Riemann Sums In 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

Defining Exponential Functions and Exponential Derivatives and Integrals

Project One: C Bump functions

Solving systems of ODEs with Matlab

MAT137 - Term 2, Week 2

Riemann Integrals and the Fundamental Theorem of Calculus

Logarithm and Exponential Derivatives and Integrals

Integration by Parts. MAT 126, Week 2, Thursday class. Xuntao Hu

Mathematical Induction Again

Mathematical Induction Again

Hölder s and Minkowski s Inequality

Math 112 Section 10 Lecture notes, 1/7/04

Calculus Dan Barbasch. Oct. 2, Dan Barbasch () Calculus 1120 Oct. 2, / 7

Newton s Cooling Model in Matlab and the Cooling Project!

OBJECTIVES Use the area under a graph to find total cost. Use rectangles to approximate the area under a graph.

Announcements. Topics: Homework:

Mathematical Induction

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

1 Introduction; Integration by Parts

Announcements. Topics: Homework:

Linear Systems of ODE: Nullclines, Eigenvector lines and trajectories

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

The First Derivative and Second Derivative Test

The First Derivative and Second Derivative Test

Linear Systems of ODE: Nullclines, Eigenvector lines and trajectories

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

Integration by Parts

Predator - Prey Model Trajectories and the nonlinear conservation law

1 Lesson 13: Methods of Integration

Taylor Polynomials. James K. Peterson. 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

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

Hölder s and Minkowski s Inequality

Predator - Prey Model Trajectories are periodic

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

MAT137 - Term 2, Week 4

Regression and Covariance

Final Problem Set. 2. Use the information in #1 to show a solution to the differential equation ), where k and L are constants and e c L be

Announcements. Topics: Homework:

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

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

Differentiating Series of Functions

Variation of Parameters

Math 122 Fall Unit Test 1 Review Problems Set A

Predator - Prey Model Trajectories are periodic

Lecture 5: Integrals and Applications

Solving Linear Systems of ODEs with Matlab

Lecture 4: Integrals and applications

A Simple Protein Synthesis Model

Sin, Cos and All That

MAT137 - Term 2, Week 5

Assignment 16 Solution. Please do not copy and paste my answer. You will get similar questions but with different numbers!

Matrices and Vectors

Assignment 1b: due Tues Nov 3rd at 11:59pm

Sin, Cos and All That

Getting Started With The Predator - Prey Model: Nullclines

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

AP Calculus AB 2nd Semester Homework List

MA 3280 Lecture 05 - Generalized Echelon Form and Free Variables. Friday, January 31, 2014.

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

Upper and Lower Bounds

Derivatives and the Product Rule

Calculus AB Topics Limits Continuity, Asymptotes

8.7 MacLaurin Polynomials

The Method of Laplace Transforms.

6.1 Antiderivatives and Slope Fields Calculus

Chapter 6 Differential Equations and Mathematical Modeling. 6.1 Antiderivatives and Slope Fields

Math 142, Final Exam, Fall 2006, Solutions

8.5 Taylor Polynomials and Taylor Series

The Method of Undetermined Coefficients.

More Protein Synthesis and a Model for Protein Transcription Error Rates

MECH : a Primer for Matlab s ode suite of functions

VII. Techniques of Integration

MATH 408N PRACTICE FINAL

Integrals. D. DeTurck. January 1, University of Pennsylvania. D. DeTurck Math A: Integrals 1 / 61

Chapter 5 Integrals. 5.1 Areas and Distances

7.3 Hyperbolic Functions Hyperbolic functions are similar to trigonometric functions, and have the following

Learning Objectives for Math 165

Consequences of Continuity

Ex. Find the derivative. Do not leave negative exponents or complex fractions in your answers.

Section 5.6. Integration By Parts. MATH 126 (Section 5.6) Integration By Parts The University of Kansas 1 / 10

More On Exponential Functions, Inverse Functions and Derivative Consequences

Learning Scientific Notebook

Practice Problems: Integration by Parts

1.4 Techniques of Integration

1 Antiderivatives graphically and numerically

Lab 2 Worksheet. Problems. Problem 1: Geometry and Linear Equations

Fourier Sin and Cos Series and Least Squares Convergence

5 Integrals reviewed Basic facts U-substitution... 4

MATHEMATICS FOR ENGINEERING

Sometimes the domains X and Z will be the same, so this might be written:

MAT 1320 Study Sheet for the final exam. Format. Topics

Transcription:

Integration by Parts Logarithms and More Riemann Sums! James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University September 16, 2013

Outline 1 IbyP with logarithms 2 Graphing Riemann Sums 3 Uniform Partition Riemann Sums

Abstract This lecture is going to talk about the new method of integration Integration by Parts again. Then we go back and talk about Riemann sums in Matlab again so we can learn how to draw a picture that represents the Riemann sum.

IbyP with logarithms We can use IbyP to handle ( some polynomial of t ) ln(t) dt. Example: (2t 2 + 4) ln(t)dt. We can complicate it a bit by letting the argument inside the ln be linear. Example: (2t 2 + 4) ln(5t)dt. And we can spin out more cases, but easier to see how it plays out with some examples.

IbyP with logarithms Example Evaluate ln(t) dt Solution Let u(t) = ln(t) and dv = dt. Then du = 1 t dt and v = dt = t. For the antiderivative v don t add an arbitrary constant C as we will add one at the end. Applying IbyP, ln(t) dt = udv = uv vdu = ln(t) t t 1 t dt = ln(t) t dt = t ln(t) t + C

IbyP with logarithms Example Evaluate t ln(3t) dt Solution Let u(t) = ln(3t) and dv = tdt. Then du = 3 3t dt = 1 t dt and v = tdt = t 2 /2. Using IbyP t ln(3t) dt = udv = uv vdu = ln(3t) t 2 /2 = t2 2 ln(3t) t 2 2 t/2 dt = t2 2 ln(3t) t2 4 + C 1 t dt

IbyP with logarithms Example Evaluate t 3 ln(8t) dt Solution Let u(t) = ln(8t) and dv = t 3 dt. Then du = 8 8t dt = 1 t dt and v = t 3 dt = t 4 /4. Applying Integration by Parts, we have t 3 ln(8t) dt = udv = uv vdu = ln(8t) t 4 /4 t 4 /4 1 t dt = t4 4 ln(8t) t 3 /4 dt = t2 2 ln(8t) t4 16 + C

IbyP with logarithms Example Evaluate (t 4 + 5t 2 + 8t + 9) ln(4t) dt Solution Let u(t) = ln(4t) and dv = (t 4 + 5t 2 + 8t + 9)dt. Then du = 4 4t dt = 1 t dt and v = (t 4 + 5t 2 + 8t + 9)dt = t 5 /5 + (5/3)t 3 + (8/2)t 2 + 9t. Applying Integration by Parts, we have (t 4 + 5t 2 + 8t + 9) ln(4t) dt = ln(4t)(t 5 /5 + (5/3)t 3 + (8/2)t 2 + 9t) (t 5 /5 + (5/3)t 3 + (8/2)t 2 + 9t) 1 t dt = ln(4t)(t 5 /5 + (5/3)t 3 + (8/2)t 2 + 9t) (t 4 /5 + (5/3)t 2 + (8/2)t + 9) dt = ln(4t)(t 5 /5 + (5/3)t 3 + (8/2)t 2 + 9t) (t 5 /25 + (5/9)t 3 + (8/4)t 2 + 9t) + C

IbyP with logarithms Homework 26 26.1 Evaluate ln(5t) dt 26.2 Evaluate 2t ln(t 2 ) dt 26.3 Evaluate (t 4 + 5t 8) ln(7t) dt 26.4 Evaluate 5 2 (t2 + 5t + 3) ln(t) dt

Graphing Riemann Sums If we want to graph the Riemann sums, we need to graph those rectangles we draw by hand. To graph a rectangle, we graph 4 lines. The MatLab command plot([x1 x2], [y1 y2]) plots a line from the pair (x1, y1) to (x2, y2). So the command plot([x(i) x(i+1)],[f(s(i)) f(s(i))]); plots the horizontal line which is the top of our rectangle.

Graphing Riemann Sums If we want to graph the Riemann sums, we need to graph those rectangles we draw by hand. To graph a rectangle, we graph 4 lines. The MatLab command plot([x1 x2], [y1 y2]) plots a line from the pair (x1, y1) to (x2, y2). So the command plot([x(i) x(i+1)],[f(s(i)) f(s(i))]); plots the horizontal line which is the top of our rectangle. The command plot([x(i) x(i)], [0 f(s(i))]); plots a vertical line that starts on the x axis at x i and ends at the function value f (s i ).

Graphing Riemann Sums The command plot([x(i+1) x(i+1)], [0 f(s(i))]); plots a vertical line that starts on the x axis at x i+1 and ends at the function value f (s i ).

Graphing Riemann Sums The command plot([x(i+1) x(i+1)], [0 f(s(i))]); plots a vertical line that starts on the x axis at x i+1 and ends at the function value f (s i ). To plot rectangle, for the first pair of partition points, first we set the axis of our plot so we will be able to see it. We use the axis command in Matlab look it up using help! If the two x points are x1 and x2 and the y value is f (s1) where s1 is the first evaluation point, we expand the x axis to [x1 1, x2 + 1] and expand the y axis to [0, f (s1)]. This allows our rectangle to be seen. The command is axis([x1-1 x2+1 0 f((s1))+1]);.

Graphing Riemann Sums The code so far Putting this all together, we plot the first rectangle like this: >> h o l d on % s e t a x i s so we can s e e r e c t a n g l e >> a x i s ( [ P( 1 ) 1 P( 2 )+1 0 f ( E ( 1 ) ) +1]) % p l o t top, LHS, RHS and bottom o f r e c t a n g l e >> p l o t ( [ P( 1 ) P( 2 ) ], [ f ( E ( 1 ) ) f ( E ( 1 ) ) ] ) ; >> p l o t ( [ P( 1 ) P( 1 ) ], [ 0 f ( E ( 1 ) ) ] ) ; >> p l o t ( [ P( 2 ) P( 2 ) ], [ 0 f ( E ( 1 ) ) ] ) ; >> p l o t ( [ P( 1 ) P( 2 ) ], [ 0 0 ] ) ; >> h o l d o f f We have to force Matlab to plot repeatedly without erasing the previous plot. We use hold on and hold off to do this. We start with hold on and then all plots are kept until the hold off is used.

Graphing Riemann Sums This generates the rectange we see below: Figure: Simple Rectangle

Graphing Riemann Sums To show the Riemann sum approximation as rectangles, we use a for loop in MatLab To put this all together, h o l d on % s e t h o l d to on f o r i = 1 : 4 % graph r e c t a n g l e s bottom = 0 ; top = f (E( i ) ) ; p l o t ( [ P( i ) P( i +1) ], [ f ( E ( i ) ) f ( E( i ) ) ] ) ; p l o t ( [ P( i ) P( i ) ], [ bottom top ] ) ; p l o t ( [ E( i ) E ( i ) ], [ bottom top ], r ) ; p l o t ( [ P( i +1) P( i +1) ], [ bottom top ] ) ; p l o t ( [ P( i ) P( i +1) ], [ 0 0 ] ) ; end h o l d o f f % s e t h o l d o f f

Graphing Riemann Sums Of course, we don t know if f can be negative, so we need to adjust our thinking as some of the rectangles might need to point down. We do that by setting the bottom and top of the rectangles using an if test.

Graphing Riemann Sums Of course, we don t know if f can be negative, so we need to adjust our thinking as some of the rectangles might need to point down. We do that by setting the bottom and top of the rectangles using an if test. bottom = 0 ; top = f (E( i ) ) ; i f f (E( i ) ) < 0 top = 0 ; bottom = f ( E ( i ) ) ; end

Graphing Riemann Sums All together, we have h o l d on % s e t h o l d to on [ s i z e P,m] = s i z e (P) ; f o r i = 1 : s i z e P 1 % graph a l l t h e r e c t a n g l e s bottom = 0 ; top = f (E( i ) ) ; i f f (E( i ) ) < 0 top = 0 ; bottom = f ( E ( i ) ) ; end p l o t ( [ P( i ) P( i +1) ], [ f ( E ( i ) ) f ( E( i ) ) ] ) ; p l o t ( [ P( i ) P( i ) ], [ bottom top ] ) ; p l o t ( [ E( i ) E ( i ) ], [ bottom top ], r ) ; p l o t ( [ P( i +1) P( i +1) ], [ bottom top ] ) ; p l o t ( [ P( i ) P( i +1) ], [ 0 0 ] ) ; end h o l d o f f ; We also want to place the plot of f over these rectangles.

Graphing Riemann Sums h o l d on % s e t h o l d to on [ s i z e P,m] = s i z e (P) ; f o r i = 1 : s i z e P 1 % graph a l l t h e r e c t a n g l e s bottom = 0 ; top = f (E( i ) ) ; i f f (E( i ) ) < 0 top = 0 ; bottom = f ( E ( i ) ) ; end p l o t ( [ P( i ) P( i +1) ], [ f ( E ( i ) ) f ( E( i ) ) ] ) ; p l o t ( [ P( i ) P( i ) ], [ bottom top ] ) ; p l o t ( [ E( i ) E ( i ) ], [ bottom top ], r ) ; p l o t ( [ P( i +1) P( i +1) ], [ bottom top ] ) ; p l o t ( [ P( i ) P( i +1) ], [ 0 0 ] ) ; end y = l i n s p a c e (P( 1 ),P( s i z e P ), 101) ; p l o t ( y, f ( y ) ) ; x l a b e l ( x a x i s ) ; y l a b e l ( y a x i s ) ; t i t l e ( Riemann Sum w i t h f u n c t i o n o v e r l a i d ) ; h o l d o f f ;

Graphing Riemann Sums We generate this figure: Figure: Riemann Sum for f (x) = x 2 for Partition {1, 1.5, 2.1, 2.8, 3.0}

Uniform Partition Riemann Sums To save typing, let s learn to use a Matlab function. In Matlab s file menu, choose create a new Matlab function which gives f u n c t i o n [ v a l u e 1, v a l u e 2,... ] = MyFunction ( arg1, arg2,... ) % s t u f f i n h e r e end MyFunction is the name of the function. This function must be stored in the file MyFunction.m.

Uniform Partition Riemann Sums To save typing, let s learn to use a Matlab function. In Matlab s file menu, choose create a new Matlab function which gives f u n c t i o n [ v a l u e 1, v a l u e 2,... ] = MyFunction ( arg1, arg2,... ) % s t u f f i n h e r e end [value1, value2,...] are returned values the function calculates that we want to save. MyFunction is the name of the function. This function must be stored in the file MyFunction.m.

Uniform Partition Riemann Sums To save typing, let s learn to use a Matlab function. In Matlab s file menu, choose create a new Matlab function which gives f u n c t i o n [ v a l u e 1, v a l u e 2,... ] = MyFunction ( arg1, arg2,... ) % s t u f f i n h e r e end [value1, value2,...] are returned values the function calculates that we want to save. (arg1, arg2,...) are things the function needs to do the calculations. They are called the arguments to the function. MyFunction is the name of the function. This function must be stored in the file MyFunction.m.

Uniform Partition Riemann Sums Our function returns the Riemann sum, RS, and use the arguments: our function f, the partition P and the Evaluation set E. Since only one value returned [RS] can be RS. f u n c t i o n RS = RiemannSum ( f, P, E ) % comments alway b e g i n w i t h a % matlab l i n e s h e r e end The name for the function RiemannSum must be used as the file name: i.e. we must use RiemannSum.m as the file name.

Uniform Partition Riemann Sums The Riemann sum function: 1 f u n c t i o n RS = RiemannSum ( f, P, E ) % f i n d Riemann sum dx = d i f f (P) ; RS = sum ( f ( E). dx ) ; [ s i z e P,m] = s i z e (P) ; %g e t s i z e o f P a r t i t i o n 6 c l f ; % c l e a r t h e o l d graph h o l d on % s e t h o l d to on f o r i = 1 : s i z e (P) 1 % graph r e c t a n g l e s % p l o t r e c t a n g l e code... end 11 % p l o t f u n c t i o n code... y = l i n s p a c e (P( 1 ),P( s i z e P ), 101) ; h o l d o f f ; end

Uniform Partition Riemann Sums Now to see graphically how the Riemann sums converge to a finite number, let s write a new function: Riemann sums using uniform partitions and midpoint evaluation sets. 1 f u n c t i o n RS = RiemannUniformSum ( f, a, b, n ) % s e t up a u n i f o r m p a r t i t i o n w i t h n+1 p o i n t s d e l t a x = ( b a ) /n ; P = [ a : d e l t a x : b ] ; % makes a row v e c t o r f o r i =1:n 6 s t a r t = a+( i 1) d e l t a x ; s t o p = a+i d e l t a x ; E ( i ) = 0. 5 ( s t a r t+s t o p ) ; end % send i n t r a n s p o s e o f P and E so we use column v e c t o r s 11 % b e c a u s e o r i g i n a l RiemannSum f u n c t i o n u s e s columns RS = RiemannSum ( f, P, E ) ; end

Uniform Partition Riemann Sums We can then generate a sequence of Riemann sums for different values of n. We generate a sequence of figures which converge to a fixed value. >> f = @( x ) s i n ( 3 x ) ; >> RS = RiemannSumTwo ( f, 1,4, 10) ; >> RS= RiemannSumTwo ( f, 1,4, 20) ; >> RS = RiemannSumTwo ( f, 1,4, 30) ; >> RS= RiemannSumTwo ( f, 1,4, 40) ;

Uniform Partition Riemann Sums Figure: The Riemann sum with a uniform partition P 10 of [ 1, 4] for n = 10. The function is sin(3x) and the Riemann sum is 0.6726.

Uniform Partition Riemann Sums Figure: Riemann sum with a uniform partition P 20 of [ 1, 4] for n = 20. The function is sin(3x) and the Riemann sum is 0.6258.

Uniform Partition Riemann Sums Figure: Riemann sum with a uniform partition P 40 of [ 1, 4] for n = 40. The function is sin(3x) and the Riemann sum is 0.6149.

Uniform Partition Riemann Sums Figure: Riemann sum with a uniform partition P 80 of [ 1, 4] for n = 80. The function is sin(3x) and the Riemann sum is 0.6122.

Uniform Partition Riemann Sums Homework 27 For the given function f, interval [a, b] and choice of n, you ll calculate the corresponding uniform partition Riemann sum using the functions RiemannSum in file RiemannSum.m and RiemannUniformSum in file RiemannUniformSum.m. You can download these functions as files from the class web site. Save them in your personal class directory. Create a new word document in single space with matlab fragments in bold font. The document starts with your name, MTHSC 111, Section, HW number and the date.

Uniform Partition Riemann Sums Homework 27 Continued 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 111, Section Number, Date and Homework number. For each value of n, do a save as and save the figure with a filename like HW#Problem#a[ ].png where [ ] is where you put the number of the graph. Something like HW17a.png, HW#Problem#b.png etc. Insert this picture into the doc resizing as needed to make it look good. Explain in the doc what the picture shows.

Uniform Partition Riemann Sums Homework 27 Continued Something like this: Jim Peterson MTHSC 111, 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}. % 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 >> RS = RiemannUniformSum ( f, 1,4,10) % add e x p l a n a t i o n h e r e >> RS = RiemannUniformSum ( f, 1,4,20) % add e x p l a n a t i o n h e r e >> RS = RiemannUniformSum ( f, 1,4,40) % add e x p l a n a t i o n h e r e >> RS = RiemannUniformSum ( f, 1,4,80)

Uniform Partition Riemann Sums Homework 26 Continued 26.1 Let f (t) = t 2 2t + 3 on the interval [ 2, 3] with n = 8, 16, 32 and 48. 26.2 Let f (t) = sin(2t) on the interval [ 1, 5] with n = 10, 40, 60 and 80. 26.3 Let f (t) = t 2 + 8t + 5 on the interval [ 2, 3] with n = 4, 12, 30 and 50.