MA2213 Lecture 4 Numerical Integration
Introduction Definition is the limit of Riemann sums I(f) is called an integral and the process of calculating it is called integration – it has an enormous range of applications
Method of Exhaustion was used in ancient times to compute areas and volumes of standard geometric objects Example: area of region between the x-axis, the graph of a function y = f(x), and the vertical lines x = a, and x = b, is given by
Fundamental Theorem of Calculus (Newton and Leibniz) implies that where F is any antiderivative of f, this means that Unfortunately, not all integrands f have ‘closed form’ antiderivatives
Left Riemann Sum [f(x 0 ) + f(x 1 ) f(x n-1 )] *Delta x
Right Riemann Sum [f(x 1 ) + f(x 2 ) f(x n )] * Delta x Midpoint Rule Animation
Midpoint Rule [f(m 1 ) + f(m 2 ) f(m n )] * Delta x Animation
Trapezoidal Rule The trapezoid approximation associated with a uniform partition a = x0 < x1 <... < xn = b is given by.5*[f(x0) + 2f(x1) f(xn-1) + f(xn)]*Delta x
Review Questions How can the trapezoidal rule be obtained from the left and right Riemann sums ? How can the trapezoidal rule be obtained from the midpoint rule ? How can the trapezoidal rule be obtained by approximating the integral of a f by the integral of an interpolant of f ?
Simpson’s Rule is obtained by computing the integral of a quadratic interpolating polynomial where
Simpson’s Rule in general divides the interval [a,b] into equal length intervals and applies the previous formula to each interval to obtain (for positive even integers n) whereand
Quadrature is based on the exact integration of polynomials of increasing degree, [a,b] is not subdivided Theorem 1 If nodes whenever are given then there exist unique weights such that in is a polynomial with degree
Quadrature 1 st Proof (Theorem 1) The quadrature equations have a nonsingular coefficient matrix (why)? 2 nd Proof Question What are?
Gaussian Quadrature is based on strategic choice of nodes (only a genius could make such a choice) so that when weightsare chosen with then also (as if by MAGIC) for polynomials f with degree We seem to get n extra equations for free ! Let us examine cases for n = 1 and for n = 2.
Gaussian Quadrature Case n = 1 for polynomials f of as large degree as possible. is to hold For f(x) = 1 Question Why is this quadrature formula exact for ALL linear polynomials ? For f(x) = x
Gaussian Quadrature Case n = 2 is to hold for the polynomials f(x) = This yields the system of four nonlinear equations whose solution is
Gaussian Quadrature Example Not bad for an estimate based on 2 nodes ! Question Why is where and why is this useful ?
Gaussian Quadrature Case n > 2 Findsuch that for Gauss solved this using orthogonal polynomials. Error Bounds Trapezoidal Simpson Gauss minimax error
Orthogonal Polynomials Definition A sequence (finite or infinite) of polynomials is called orthogonal over an interval [a,b] if Question 1. Show that condition 1 implies that (called the scalar product of the 2 functions) is a basis for { poly. deg < k}
Orthogonal Polynomials Question 2. Show that conditions 1 and 2 imply for polynomials Theorem 2. with deg hasdistinct roots in Proof Assume thathas only m < k distinct roots with odd multiplicity in Define Sincedoes not change sign on This contradicts Question 2.
Gaussian Quadrature Theorem 2. If zeros ofwhere are chosen to be the and are orthogonal by Thm 1 so that whenever f is a poly. deg < n are chosen then this same equation holds if f has deg. < 2n polynomials over Proof Divide to obtainwhere g and h are polynomials with Then
Homework Due at End of Lab 2 Question 1. for the function Compute the least squares approximation over the interval [-1,1] from the set S of functions that are continuous on [-1,1] and linear on [-1,0] and on [0,1]. Express your solution as a linear combination of the basis functions for S described in the 1 st vufoil in Lecture 3. The coefficients of this linear combination are solutions of a system of 3 linear equation whose matrix of coefficients is the Gramm matrix that you computed for Question 4 in the previous Homework. Write a MATLAB program in an MATLAB.m-file to solve this linear system of equations.