Module 11.4: nag quad util Numerical Integration Utilities. Contents

Similar documents
D01BBF NAG Fortran Library Routine Document

NAG Fortran Library Routine Document D01BBF.1

Orthogonal Polynomials

Math 1B, lecture 4: Error bounds for numerical methods

Numerical integration

Construction of Gauss Quadrature Rules

Matrices, Moments and Quadrature, cont d

NUMERICAL INTEGRATION. The inverse process to differentiation in calculus is integration. Mathematically, integration is represented by.

Module 10.2: nag nlin eqn Roots of a Single Nonlinear Equation. Contents

Theoretical foundations of Gaussian quadrature

Lecture 6: Singular Integrals, Open Quadrature rules, and Gauss Quadrature

Lecture 14: Quadrature

Interpolation. Gaussian Quadrature. September 25, 2011

Numerical Analysis. 10th ed. R L Burden, J D Faires, and A M Burden

3.4 Numerical integration

New Expansion and Infinite Series

1 The Lagrange interpolation formula

1. Gauss-Jacobi quadrature and Legendre polynomials. p(t)w(t)dt, p {p(x 0 ),...p(x n )} p(t)w(t)dt = w k p(x k ),

Review of Gaussian Quadrature method

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

Lecture 14 Numerical integration: advanced topics

Numerical quadrature based on interpolating functions: A MATLAB implementation

63. Representation of functions as power series Consider a power series. ( 1) n x 2n for all 1 < x < 1

Review of Calculus, cont d

Numerical Integration. 1 Introduction. 2 Midpoint Rule, Trapezoid Rule, Simpson Rule. AMSC/CMSC 460/466 T. von Petersdorff 1

Suppose we want to find the area under the parabola and above the x axis, between the lines x = 2 and x = -2.

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Section 6.1 Definite Integral

Best Approximation in the 2-norm

The Fundamental Theorem of Calculus. The Total Change Theorem and the Area Under a Curve.

Numerical Integration

COSC 3361 Numerical Analysis I Numerical Integration and Differentiation (III) - Gauss Quadrature and Adaptive Quadrature

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

B.Sc. in Mathematics (Ordinary)

JDEP 384H: Numerical Methods in Business

Trapezoidal Rule, n = 1, x 0 = a, x 1 = b, h = b a. f (x)dx = h 2 (f (x 0) + f (x 1 )) h3

Improper Integrals, and Differential Equations

Module 3.9: nag kelvin fun Kelvin Functions. Contents

Chapter 3 Polynomials

Numerical Analysis: Trapezoidal and Simpson s Rule

APPROXIMATE INTEGRATION

INTRODUCTION TO INTEGRATION

Math& 152 Section Integration by Parts

1 Linear Least Squares

NOTES ON HILBERT SPACE

8 Laplace s Method and Local Limit Theorems

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

Discrete Least-squares Approximations

Abstract inner product spaces

Predict Global Earth Temperature using Linier Regression

x = b a N. (13-1) The set of points used to subdivide the range [a, b] (see Fig. 13.1) is

Lecture 19: Continuous Least Squares Approximation

III. Lecture on Numerical Integration. File faclib/dattab/lecture-notes/numerical-inter03.tex /by EC, 3/14/2008 at 15:11, version 9

Module 10.1: nag polynom eqn Roots of Polynomials. Contents

Riemann Sums and Riemann Integrals

Riemann Sums and Riemann Integrals

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

Continuous Random Variables

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

NUMERICAL INTEGRATION

Lecture Notes: Orthogonal Polynomials, Gaussian Quadrature, and Integral Equations

Math 8 Winter 2015 Applications of Integration

We partition C into n small arcs by forming a partition of [a, b] by picking s i as follows: a = s 0 < s 1 < < s n = b.

Lecture 20: Numerical Integration III

MATH34032: Green s Functions, Integral Equations and the Calculus of Variations 1

Section 4.8. D v(t j 1 ) t. (4.8.1) j=1

Numerical Integration

Numerical Integration. Newton Cotes Formulas. Quadrature. Newton Cotes Formulas. To approximate the integral b

Read section 3.3, 3.4 Announcements:

P 3 (x) = f(0) + f (0)x + f (0) 2. x 2 + f (0) . In the problem set, you are asked to show, in general, the n th order term is a n = f (n) (0)

Lecture 17. Integration: Gauss Quadrature. David Semeraro. University of Illinois at Urbana-Champaign. March 20, 2014

Main topics for the First Midterm

MATH 144: Business Calculus Final Review

4 7x =250; 5 3x =500; Read section 3.3, 3.4 Announcements: Bell Ringer: Use your calculator to solve

The Fundamental Theorem of Calculus

p(x) = 3x 3 + x n 3 k=0 so the right hand side of the equality we have to show is obtained for r = b 0, s = b 1 and 2n 3 b k x k, q 2n 3 (x) =

Jim Lambers MAT 169 Fall Semester Lecture 4 Notes

Tests for the Ratio of Two Poisson Rates

JACOBI MATRICES FOR MEASURES MODIFIED BY A RATIONAL FACTOR. This paper decribes how, given the Jacobi matrix J for the measure d(t), it is possible to

Efficient Computation of a Class of Singular Oscillatory Integrals by Steepest Descent Method

ODE: Existence and Uniqueness of a Solution

1 The Riemann Integral

University of Texas MD Anderson Cancer Center Department of Biostatistics. Inequality Calculator, Version 3.0 November 25, 2013 User s Guide

We divide the interval [a, b] into subintervals of equal length x = b a n

MA 124 January 18, Derivatives are. Integrals are.

37 Kragujevac J. Math. 23 (2001) A NOTE ON DENSITY OF THE ZEROS OF ff-orthogonal POLYNOMIALS Gradimir V. Milovanović a and Miodrag M. Spalević

The Wave Equation I. MA 436 Kurt Bryan

Acceptance Sampling by Attributes

CAAM 453 NUMERICAL ANALYSIS I Examination There are four questions, plus a bonus. Do not look at them until you begin the exam.

Orthogonal Polynomials and Least-Squares Approximations to Functions

( dg. ) 2 dt. + dt. dt j + dh. + dt. r(t) dt. Comparing this equation with the one listed above for the length of see that

UNIT 1 FUNCTIONS AND THEIR INVERSES Lesson 1.4: Logarithmic Functions as Inverses Instruction

Definite integral. Mathematics FRDIS MENDELU

38 Riemann sums and existence of the definite integral.

Module 5.2: nag sym lin sys Symmetric Systems of Linear Equations. Contents

Section 7.1 Integration by Substitution

Disclaimer: This Final Exam Study Guide is meant to help you start studying. It is not necessarily a complete list of everything you need to know.

Overview of Calculus I

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

Chapter 1. Basic Concepts

Transcription:

Qudrture Module Contents Module 11.4: ng qud util Numericl Integrtion Utilities ng qud util provides utility procedures for computtion involving integrtion of functions, e.g., the computtion of the weights nd bscisse for Gussin integrtion rules. Contents Introduction... 11.4.3 Procedures ng qud gs wt bsc... 11.4.5 Clcultion of weights nd bscisse for Gussin qudrture rules, generl choice of rule Exmples Exmple 1: Abscisse nd weights by Guss Legendre formul... 11.4.11 Additionl Exmples... 11.4.13 References... 11.4.14 [NP3245/3/pdf] Module 11.4: ng qud util 11.4.1

Module Contents Qudrture 11.4.2 Module 11.4: ng qud util [NP3245/3/pdf]

Qudrture Module Introduction Introduction This module provides procedures which perform tsks in numericl integrtion. Currently, one procedure is vilble which computes the weights (norml or djusted) nd bscisse for six different types of Gussin integrtion rules. [NP3245/3/pdf] Module 11.4: ng qud util 11.4.3

Module Introduction Qudrture 11.4.4 Module 11.4: ng qud util [NP3245/3/pdf]

Qudrture ng qud gs wt bsc Procedure: ng qud gs wt bsc 1 Description ng qud gs wt bsc computes the weights (norml or djusted) nd bscisse ssocited with six different Guss rules. These weights nd bscisse my be used for the pproximtion of definite integrls (see Stroud nd Secrest [2], or pges 73 105 of Dvis nd Rbinowitz [1]). 2 Usge USE ng qud util CALL ng qud gs wt bsc(rule,, b, wt, x [, optionl rguments]) 3 A rguments Note. All rry rguments re ssumed-shpe rrys. The extent in ech dimension must be exctly tht required by the problem. Nottion such s x(n) is used in the rgument descriptions to specify tht the rry x must hve exctly n elements. This procedure derives the vlue of the following problem prmeter from the shpe of the supplied rrys. n 1 the number of Gussin weights nd bscisse 3.1 Mndtory Arguments rule integer, intent(in) Input: indictes the qudrture rule to be used s specified in Section 6.1: if rule = 0 for the Guss Legendre rule; if rule = 1 for the Guss Jcobi rule with norml weights; if rule = 1 for the Guss Jcobi rule with djusted weights; if rule = 2 for the Guss Exponentil rule with norml weights; if rule = 2 for the Guss Exponentil rule with djusted weights; if rule = 3 for the Guss Lguerre rule with norml weights; if rule = 3 for the Guss Lguerre rule with djusted weights; if rule = 4 for the Guss Hermite rule with norml weights; if rule = 4 for the Guss Hermite rule with djusted weights; if rule = 5 for the Guss Rtionl rule with norml weights; if rule = 5 for the Guss Rtionl rule with djusted weights. Constrints: 5 rule 5. rel(kind=wp), intent(in) b rel(kind=wp), intent(in) Input: the prmeters nd b which occur in the qudrture formule s specified in Section 6.1. Constrints: If rule =0,±1 or±2, then < b; if rule = ±3, then b 0; if rule = ±4, then b > 0; if rule = ±5, then + b 0. [NP3245/3/pdf] Module 11.4: ng qud util 11.4.5

ng qud gs wt bsc Qudrture wt(n) rel(kind=wp), intent(out) x(n) rel(kind=wp), intent(out) Output: the n weights nd bscisse of the Guss rule. Note: if rule = 2 or 4 nd the optionl rgument c 0.0, then n odd number of weights nd bscisse, n, my rise n error condition (see error%code = 204 in Section 4). 3.2 Optionl Arguments Note. Optionl rguments must be supplied by keyword, not by position. The order in which they re described below my differ from the order in which they occur in the rgument list. c rel(kind=wp), intent(in), optionl d rel(kind=wp), intent(in), optionl Input: the prmeters c nd d which occur in some of the qudrture formule (see Section 6.1). For some rules c nd d must not be too lrge (see Section 4). Note: If rule =0,thenc nd d should not be present; if rule = ±2, ±3 or±4, then d should not be present. Constrints: if rule = ±1, then c > 1 ndd > 1; if rule = ±2, ±3 or±4, then c > 1; if rule = ±5, then c > 1 ndd > c +1. error type(ngerror), intent(inout), optionl The NAG fl 90 error-hndling rgument. See the Essentil Introduction, or the module document ng error hndling (1.2). You re recommended to omit this rgument if you re unsure how to use it. If this rgument is supplied, it must be initilized by cll to ng set error before this procedure is clled. 4 Error Codes Ftl errors (error%level = 3): error%code Description 301 An input rgument hs n invlid vlue. 303 Arry rguments hve inconsistent shpes. 305 Invlid bsence of n optionl rgument. Filures (error%level = 2): error%code Description 201 Convergence not chieved. ng sym tridig eig ll hs filed to obtin convergence. 202 One or more of the weights re lrger thn HUGE(1.0 wp), the lrgest floting-point number on this mchine. The overflowing weights re returned s HUGE(1.0 wp). Possible solutions re to use smller vlue of n; or, if using djusted weights, to chnge to norml weights. To exmine the vlues of the weights fter this filure, you must supply the optionl rgument error nd initilise it using ng set error nd set hlt level to 3 (see the Essentil Introduction or the module ng error hndling for hndling error exits). 11.4.6 Module 11.4: ng qud util [NP3245/3/pdf]

Qudrture ng qud gs wt bsc 203 One or more of the weights re too smll to be distinguished from zero on this mchine. The underflowing weights re returned s zero, which my be usble pproximtion. Possible solutions re to use smller vlue of n; or, if using norml weights, to chnge to djusted weights. To exmine the vlues of the weights fter this filure, you must supply the optionl rgument error nd initilise it using ng set error nd set hlt level to 3 (see the Essentil Introduction or the module ng error hndling for hndling error exits). 204 Guss Exponentil or Guss Hermite djusted weights with n odd nd c 0.0. Theoreticlly, in these cses: for c > 0.0, the centrl djusted weight is infinite, nd the exct function f(x) is zero t the centrl bsciss; for c < 0.0, the centrl djusted weight is zero, nd the exct function f(x) is infinite t the centrl bsciss. In either cse, indeterminte. the contribution of the centrl bsciss to the summtion is In prctice, the centrl weight my not hve overflowed or underflowed, if there is sufficient rounding error in the vlue of the centrl bsciss. If the soft fil option is used, the weights nd bsciss returned my be usble; the user must be prticulrly creful not to round the centrl bsciss to its true vlue without simultneously rounding the centrl weight to zero or s pproprite, or the summtion will suffer. It would be preferble to use norml weights, if possible. It is importnt to remember tht, when switching from norml weights to djusted weights or vice vers, redefinition of f(x) isinvolved. Wrnings (error%level = 1): error%code Description 101 Optionl rgument present but not used If rule =0,cnd d should not be present; if rule = ±2 or±3 or±4, d should not be present. 5 Exmples of Usge Acomplete exmple of the use of this procedure ppers in Exmple 1 of this module document. 6 Further Comments 6.1 Mthemticl Bckground This procedure computes the weights w i nd bscisse x i for use in the summtion S = n w i f(x i ) i=1 which pproximtes definite integrl (see Stroud nd Secrest [2], or pges 73 105 of Dvis nd Rbinowitz [1]). The following types re provided: [NP3245/3/pdf] Module 11.4: ng qud util 11.4.7

ng qud gs wt bsc Qudrture 1. Guss Legendre: b Constrint: b>. 2. Guss Jcobi: norml weights: b djusted weights: b f(x) dx, exct for f(x) =P 2n 1 (x). (b x) c (x ) d f(x) dx, exct for f(x) =P 2n 1 (x), f(x) dx, exct for f(x) =(b x) c (x ) d P 2n 1 (x). Constrint: c> 1, d> 1, b>. 3. Guss Exponentil: norml weights: b x + b c 2 f(x) dx, exct for f(x) =P 2n 1 (x), djusted weights: b f(x) dx, exct for f(x) = x + b c 2 P 2n 1 (x). Constrint: c> 1, b>. 4. Guss Lguerre: norml weights: djusted weights: x c e bx f(x) dx (b >0), x c e bx f(x) dx (b <0), exct for f(x) =P 2n 1 (x), f(x) dx (b >0), Constrint: c> 1, b 0. 5. Guss Hermite: norml weights: + djusted weights: + Constrint: c> 1, b>0. f(x) dx (b <0), exct for f(x) = x c e bx P 2n 1 (x). x c e b(x )2 f(x) dx, exct for f(x) =P 2n 1 (x), f(x) dx, exct for f(x) = x c e b(x )2 P 2n 1 (x). 11.4.8 Module 11.4: ng qud util [NP3245/3/pdf]

Qudrture ng qud gs wt bsc 6. Guss Rtionl: norml weights: S x c f(x) dx ( + b>0), x + b d x c ( ) 1 x + b d f(x) dx ( + b<0), exct for f(x) =P 2n 1, x + b djusted weights: S f(x) dx ( + b>0), f(x) dx ( + b<0), exct for f(x) = ( ) x c 1 x + b d P 2n 1. x + b Constrint: c> 1, d>c+1, + b 0. In the bove formule, P 2n 1 (x) stnds for ny polynomil of degree 2n 1orlessinx. 6.2 Algorithmic Detil The method used is to clculte the bscisse, using ng sym tridig eig ll to find the eigenvlues of the pproprite tridigonl mtrix (see Golub nd Welsch [3]). The weights re then determined by the formul: 1 n 1 w i = Pj (x i ) 2 j=0 where Pj (x) isthejth orthogonl polynomil with respect to the weight function over the pproprite intervl. 6.3 Accurcy The ccurcy depends minly on n, with incresing loss of ccurcy for lrger vlues of n. Typiclly, one or two deciml digits my be lost from mchine ccurcy with n 20, nd three or four deciml digits my be lost for n 100. 6.4 Timing The mjor portion of the time is tken up by ng sym tridig eig ll during the clcultion of the bscisse, where the time is roughly proportionl to n 3. [NP3245/3/pdf] Module 11.4: ng qud util 11.4.9

ng qud gs wt bsc Qudrture 11.4.10 Module 11.4: ng qud util [NP3245/3/pdf]

Qudrture Exmple 1 Exmple 1: Abscisse nd weights by Guss Legendre formul Genertes bscisse nd weights using the Guss Legendre 7-point formul. 1 Progrm Text Note. The listing of the exmple progrm presented below is double precision. Single precision users re referred to Section 5.2 of the Essentil Introduction for further informtion. PROGRAM ng_qud_util_ex01! Exmple Progrm Text for ng_qud_util! NAG fl90, Relese 3. NAG Copyright 1997.!.. Use Sttements.. USE ng_exmples_io, ONLY : ng_std_out USE ng_qud_util, ONLY : ng_qud_gs_wt_bsc!.. Implicit None Sttement.. IMPLICIT NONE!.. Intrinsic Functions.. INTRINSIC KIND!.. Prmeters.. INTEGER, PARAMETER :: n = 7 INTEGER, PARAMETER :: wp= KIND(1.0D0)!.. Locl Sclrs.. INTEGER :: j, rule REAL (wp) ::, b!.. Locl Arrys.. REAL (wp) :: wt(n), x(n)!.. Executble Sttements.. WRITE (ng_std_out,*) Exmple Progrm Results for ng_qud_util_ex01 = -1.0_wp b = 1.0_wp rule = 0 CALL ng_qud_gs_wt_bsc(rule,,b,wt,x) WRITE (ng_std_out,*) WRITE (ng_std_out, (1X,A,I3,A) ) Legendre formul,, n, points WRITE (ng_std_out,*) WRITE (ng_std_out, (6X,A,8X,A) ) Abscisse, Weights WRITE (ng_std_out,*) WRITE (ng_std_out, (2F15.5) ) (x(j),wt(j),j=1,n) END PROGRAM ng_qud_util_ex01 2 Progrm Dt None. 3 Progrm Results Exmple Progrm Results for ng_qud_util_ex01 Legendre formul, Abscisse 7 points Weights -0.94911 0.12948-0.74153 0.27971-0.40585 0.38183 [NP3245/3/pdf] Module 11.4: ng qud util 11.4.11

Exmple 1 Qudrture 0.00000 0.41796 0.40585 0.38183 0.74153 0.27971 0.94911 0.12948 11.4.12 Module 11.4: ng qud util [NP3245/3/pdf]

Qudrture Additionl Exmples Additionl Exmples Not ll exmple progrms supplied with NAG fl 90 pper in full in this module document. The following dditionl exmples, ssocited with this module, re vilble. ng qud util ex02 Genertes bscisse with both weights nd djusted weights using the Guss Jcobi 7-point formul. ng qud util ex03 Genertes bscisse with both weights nd djusted weights using the Guss Exponentil 7-point formul. ng qud util ex04 Genertes bscisse with both weights nd djusted weights using the Guss Lguerre 7-point formul. ng qud util ex05 Genertes bscisse with both weights nd djusted weights using the Guss Hermite 7-point formul. ng qud util ex06 Genertes bscisse with both weights nd djusted weights using the Guss Rtionl 7-point formul. [NP3245/3/pdf] Module 11.4: ng qud util 11.4.13

References Qudrture References [1] Dvis P J nd Rbinowitz P (1975) Methods of Numericl Integrtion Acdemic Press [2] Stroud AH nd Secrest D (1966) Gussin Qudrture Formuls Prentice-Hll [3] Golub G H nd Welsch J H (1969) Clcultion of Guss qudrture rules Mth. Comput. 23 221 230 11.4.14 Module 11.4: ng qud util [NP3245/3/pdf]