Integration Using the Gauss Quadrature Rule - Convergence

Similar documents
Romberg Integration - Method

5/21/08 2:16 PM \\eng\files\numerical Methods\sim...\mtl_dif_sim_secondorderdif.m 1 of 5

Oscillation around a local maxima of minima--newton-raphson Method.

Newton-Raphson Method--Convergence of the Roots.

Direct Method of Interpolation - Simulation.

0.1 Numerical Integration Rules Using Maple

D01ARF NAG Fortran Library Routine Document

MA 111 Project #1 Curve Fitting

Math 467 Homework Set 1: some solutions > with(detools): with(plots): Warning, the name changecoords has been redefined

Integration. Volume Estimation

Lesson 12: Angles Associated with Parallel Lines

D01GCF NAG Fortran Library Routine Document

Numerical Methods with Matlab: Implementations and Applications. Gerald W. Recktenwald. Chapter 11 Numerical Integration

COMPUTING AND DATA ANALYSIS WITH EXCEL. Numerical integration techniques

CALCULUS LABORATORY ACTIVITY: Numerical Integration, Part 1

Numerical Integration

Lagrange Multipliers

Numerical Methods for Differential Equations Contents Review of numerical integration methods Rectangular Rule Trapezoidal Rule Simpson s Rule How to

Functions of Several Variables, Limits and Derivatives

Visualizing Linear Transformations in R 3

nag 1d quad gauss 1 (d01tac)

Lecture 07. (with solutions) Summer 2001 Victor Adamchik. 2 as an infinite product of nested square roots. M #'((((((((((((((((((((((((((((( 2 ] # N

Getting to Know Maple

FAQ: Advanced Functions

Math 182. Assignment #4: Least Squares

C3 Numerical methods

Concepts of Conversion of Base 10 Number to Base 2 Fixed Point Register Binary Number Representation

Fourier Series. Period 2π over the interval [ π, π]. > > restart:with(plots): Warning, the name changecoords has been redefined

Direction Fields; Euler s Method

Homework: Study 6.1 # 1, 5, 7, 13, 25, 19; 3, 17, 27, 53

CS141: Intermediate Data Structures and Algorithms Analysis of Algorithms

SYDE 312 UNIT 4: EXTRA QUADRATURE PROBLEMS

DWMJL. i Mrs. Rouse carried a small in- Board of T r a d e to adopt or s p o n - of Hastings.

nag 1d quad gauss (d01bac)

9.1 Solutions, Slope Fields, and Euler s Method

A Tutorial for Excel 2002 for Windows

13.6 Directional derivatives,

Introduction to C++ Introduction to C++ Week 6 Dr Alex Martin 2013 Slide 1

CS141: Intermediate Data Structures and Algorithms Analysis of Algorithms

NAG Library Routine Document D01BAF.1

NUMERICAL INTEGRATION AND FUNCTION FUNCTIONS

Half day Excel workshops suggested content

6.001 SICP. Types. Types compound data. Types simple data. Types. Types procedures

D-Optimal Designs. Chapter 888. Introduction. D-Optimal Design Overview

Chapter Binary Representation of Numbers

LOWELL WEEKLY JOURNAL

8/31/08 12:02 AM C:\Documents and Settings\SR.IA-3\Des...\mtl_aae_sim_quadratic.m 1 of 6

AMS527: Numerical Analysis II

Worksheets for GCSE Mathematics. Trigonometry. Mr Black's Maths Resources for Teachers GCSE 1-9. Shape

Introduction to Computer Programming with MATLAB Calculation and Programming Errors. Selis Önel, PhD

Introduction to numerical algorithms

Applications of Integration. Copyright Cengage Learning. All rights reserved.

Year 7 Term 1 Intermediate

Problem Exam Review ER-1. (E & P Exercise 2.4-6, Symbolic Solution)

Objectives. Materials

2. Use the above table to transform the integral into a new integral problem using the integration by parts formula below:

This document describes how I implement the Newton method using Python and Fortran on the test function f(x) = (x 1) log 10 (x).

Hyperbola for Curvilinear Interpolation

CHAPTER 5 NUMERICAL INTEGRATION METHODS OVER N- DIMENSIONAL REGIONS USING GENERALIZED GAUSSIAN QUADRATURE

ES-2 Lecture: Fitting models to data

Excel VLOOKUP. An EMIS Coordinator s Friend

Objectives. Materials

Microsoft Excel Lookup Functions - Reference Guide

4.7 Approximate Integration

Microsoft Excel Basics Ben Johnson

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation

NAG Library Function Document nag_quad_md_gauss (d01fbc)

(1) (2) (3) (4) C32 := u^2 * d^2 * S; C10 := d^2 * S; C23 := u^3 * S; C22 := u^2 * d * S; C20 := d^3 * S; C34 := u^4 * S; C33 := u^3 * d * S;

Notice that the height of each rectangle is and the width of each rectangle is.

Excel Part 3 Textbook Addendum

Review Ch. 15 Spreadsheet and Worksheet Basics. 2010, 2006 South-Western, Cengage Learning

The diagram above shows a sketch of the curve C with parametric equations

Using the CRM Pivot Tables

A Low Level Introduction to High Dimensional Sparse Grids

Autar Kaw Benjamin Rigsby. Transforming Numerical Methods Education for STEM Undergraduates

Linear Equation Systems Iterative Methods

Chapter 7 TECHNIQUES OF INTEGRATION

1 Programs for double integrals

Intermediate Excel Training Course Content

Performing Basic Calculations

Excel 2016: Part 2 Functions/Formulas/Charts

Without fully opening the exam, check that you have pages 1 through 11.

Purpose: To learn to use and format Mathcad worksheets. To become familiar with documenting related Excel/Mathcad homework assignments.

Math/CS 467/667 Combined Programming 2 and Homework 2. The Shu Oscher Method

MS Excel How To Use VLOOKUP In Microsoft Excel

Daily WeBWorK, #1. This means the two planes normal vectors must be multiples of each other.

Linear Programming with Bounds

Differentiation and Integration

practice: quadratic functions [102 marks]

Excel Formulas 2018 Cindy Kredo Page 1 of 23

Practice with Parameterizing Curves and Surfaces. (Part 1)

Jump Right In! Essential Computer Skills Using Microsoft 2013 By Andrews, Dark, and West

Basic Maple Tutorial

Lab 7 Statistics I LAB 7 QUICK VIEW

Chapter 3. Numerical Differentiation, Interpolation, and Integration. Instructor: Dr. Ming Ye

EXPLORING RATIONAL FUNCTIONS GRAPHICALLY

1/8/08 5:28 PM \\eng\files\numerical Methods\simulatio...\mtl_ode_sim_RK2ndconv.m 1 of 5

An Introduction to Maple and Maplets for Calculus

Introduction to MS Excel Management Information Systems

NAG Fortran Library Routine Document D01AJF.1

Transcription:

Integration Using the Gauss Quadrature Rule - Convergence 2004 Autar Kaw, Loubna Guennoun, University of South Florida, kaw@eng.usf.edu, http://numericalmethods.eng.usf.edu NOTE: This worksheet demonstrates the use of Maple to illustrate the Gauss Quadrature rule of integration. Introduction Gauss Quadrature Rule is another method of estimating an integral. The theory behind the two point Gauss Quadrature Rule is to approximate the integral by taking the area under a straight line connecting any two points on the curve that are not predetermined as a and b, but as unknowns x 1 and x 2. For n-points rules, the general form to approximate the integral is b f ( x) dx c1 f ( x1 ) + c2 f ( x2) +... + cn f ( x n ) a where c i and x i are the weighting factors and function arguments used in Gauss Quadrature formulas, respectively. However, these factors and arguments are already defined to approximate any integral from -1 to 1. To be able to use them, the limits of the integral of the function f(x) need to be changed to [-1,1]. b a f ( x) dx = 1 b a b a b + a f x + dx 2 2 2 1 NOTE: Weighting factors c and function arguments x used in Gauss Quadrature Rule have already been defined in the textbook for up to six points. The following procedure will illustrate the Gauss Quadrature Rule of integration. The user may enter any function f(x), the lower and upper limit for the function, and the number of points n in the data section (up to six points). By entering this data, the program will calculate the exact value of the integral, followed by the results using the Gauss Quadrature Rule with n points. The program will also display the true error, the absolute relative true percentage error, the approximate error, the absolute relative approximate percentage error, and the number of significant digits that are at least correct. > restart; Section I: Input Data

The following is the data that is used to solve the integral using the Gauss Quadrature rule with n points. The integrand : > f:=x->300*x/(1+exp(x)); The lower limit of the integral: > a:=0.0; The upper limit of the integral: > b:=10.0; f := x a := 0. 300 x 1 + e x b := 10.0 The number of points n: NOTE: the number of points should be between 1 and 6 > n:=6; n := 6 This is the end of the user's section. All information must be entered before proceeding to the next section. Section II: Procedure The following procedure determines the approximate value of the integral with n points. > Gauss:=proc(n,a,b,f) local AV,C,X,f_new,sum,i: The weighting factors for Gauss Quadrature rule for n points (up to six points) C:=array(1..6,1..6): C[1,1]:=2: C[1,2]:=1;C[2,2]:=1: C[1,3]:=0.555555556:C[2,3]:=0.888888889:C[3,3]:=0.555555556: C[1,4]:=0.347854845:C[2,4]:=0.652145155:C[3,4]:=0.652145155:C[4,4]:=0.347854845: C[1,5]:=0.236926885:C[2,5]:=0.478628670:C[3,5]:=0.568888889:C[4,5]:=0.478628670:C[5,5]:=0.236926885: C[1,6]:=0.171324492:C[2,6]:=0.360761573:C[3,6]:=0.467913935:C[4,6]:=0.467913935:C[5,6]:=0.360761573:C[6,6]:=0.171324492: The function arguments for Gauss quadrature rule for n points (up to six points) X:=array(1..6,1..6): X[1,1]:=0: X[1,2]:=-0.577350269:X[2,2]:=0.577350269:

X[1,3]:=-0.774596669:X[2,3]:=0:X[3,3]:=0.774596669: X[1,4]:=-0.861136312:X[2,4]:=-0.339981044:X[3,4]:=0.339981044:X [4,4]:=0.861136312: X[1,5]:=-0.906179846:X[2,5]:=-0.538469310:X[3,5]:=0:X[4,5]:=0.5 38469310:X[5,5]:=0.906179846: X[1,6]:=-0.932469514:X[2,6]:=-0.661209386:X[3,6]:=-0.238619186: X[4,6]:=0.238619186:X[5,6]:=0.661209386:X[6,6]:=0.932469514: f_new:=x->f((b-a)/2*x+(b+a)/2)*(b-a)/2: sum:=0: for i from 1 by 1 to n do sum:=sum+c[i,n]*f_new(x[i,n]): end do: AV:=sum: return (AV): end proc: Section III: Calculation > plot(f(x),x=a..b,title="f(x) vs x",thickness=3, color=black);

The exact value of the integral (EV) : > EV:=evalf(int(f(x),x=a..b)): > for i from 1 by 1 to n do AV is the average value of the integral using n points AV[i]:=Gauss(i,a,b,f): Et is the true error Et[i]:=EV-AV[i]: abs_et is the absolute relative true percentage error abs_et[i]:=abs(et[i]/ev)*100.0: if (i>1) then Ea is the approximate error Ea[i]:=AV[i]-AV[i-1]: ea is the absolute approximate relative percentage error ea[i]:=abs(ea[i]/av[i])*100.0: sig is the least correct significant digits sig[i]:=floor((2-log10(ea[i]/0.5))):

if sig[i]<0 then sig[i]:=0: end if: end if: end do: Section IV: Spreadsheet > with( Spread ): > EvaluateSpreadsheet(Gauss): 1 A The number of points B Exact Value C Approximate Value D True Err 2 1 246.5903 100.3928 146.197 3 2 246.5903 346.2051-99.614 4 3 246.5903 275.4838-28.893 5 4 246.5903 243.9871 2.6032 6 5 246.5903 245.3995 1.1908 7 6 246.5903 246.6540-0.063 Section V:Graphs > with(plots): Warning, the name changecoords has been redefined > data:=[seq([i,av[i]],i=1..n)]: > pointplot(data,connect=true,color=red,axes=boxed,title="approxi mate value of the integral as a function of the number of points",axes=boxed,labels=["number of points","av"],thickness=3); > data:=[seq([i,et[i]],i=1..n)]: > pointplot(data,connect=true,color=blue,axes=boxed,title="true error as a function of the number of points",axes=boxed,labels=["number of points","et"],thickness=3);

> data:=[seq([i,abs_et[i]],i=1..n)]: > pointplot(data,connect=true,color=blue,axes=boxed,title="absolu te relative true percentage error as a function of the number of points",axes=boxed,labels=["number of points","abs_et"],thickness=3); > data:=[seq([i,ea[i]],i=2..n)]: > pointplot(data,connect=true,color=green,axes=boxed,title="appro ximate error as a function of the number of points",axes=boxed,labels=["number of points","ea"],thickness=3); > data:=[seq([i,ea[i]],i=2..n)]: > pointplot(data,connect=true,color=green,axes=boxed,title="absol ute approximate relative percentage error as a function of the number of points",axes=boxed,labels=["number of points","ea"],thickness=3); > data:=[seq([i,sig[i]],i=2..n)]: > pointplot(data,connect=true,color=brown,axes=boxed,title="the least correct significant digits as a function of the number of points",axes=boxed,labels=["number of points","sig"],thickness=3);

> >