Four beautiful quadrature rules

06/14/2019 ∙ by Mário M. Graça, et al. ∙ University of Lisbon 0

A framework is presented to compute approximations of an integral I(f)=∫_a^b f(x) dx from a pair of companion rules and its associate rule. We show that an associate rule is a weighted mean of two companion rules. In particular, the trapezoidal (T) and Simpson (S) rules are weighted means of the companion pairs (L,R) and (T,M) respectively, with L the left rectangle, R the right rectangle and M the midpoint rules. As L,R,T and M reproduce exactly the number π=∫_0^π 2 sin^2(x) dx, we named them the four "beautiful" rules. For this example the geometrical interpretation of the rules suggest possible applications of the transcendental number π in architectural design, justifying the attribute beautiful given to the mentioned rules. As a complement we consider other appropriate integrand functions f, applying composite rules in order to obtain good approximations of π, as shown in the worked numerical examples.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

From the antiquity to Newton [9] and Gauss [4] times, and from Gauss to nowadays a great amount of ingenious work to approximate an integral took place giving rise to a plethora of quadrature rules [9], [13], [3], [7], [1], [10], [11], [8]. We will restrict the discussion to the simplest quadrature rules, known as left rectangle (L), right rectangle (R), midpoint (M) and trapezoidal (T). We call them the four ‘beautiful’ rules since all exactly reproduce the number , as shown in a worked example (see Section 4 and Figures 1, 2 and 3), and the respective geometrical interpretation suggests an application of this transcendental number in architectural design.

After defining two main types of rules, the Taylor and interpolatory ones, we assign a sign to a rule (Definition 2.2). From a pair of basic rules – with opposite errors and the same degree of precision – hereafter called companion rules, we construct another rule, which will be called as associate rule. In particular, we show that the trapezoidal rule is the associate rule to the pair (L,R), and the famous Simpson’s rule is the associate rule to the pair (M,T).

Similar (elementar) approach can be applied to other well known sets of quadrature rules, namely to certain pairs of closed and open Newton–Cotes rules [6], but we keep our discussion restricted to a small set of simpler rules.

The consideration of companion rules enables the construction of a nest of intervals where it lies the exact value . Thus, one automatically obtain error bounds for a triple of rules (X,Y,Z) where X and Y are companion rules and is the respective associate rule.

Under mild assumptions, we show that the expression of an associate rule is a weighted mean, with positive weights, of its companion rules. Therefore, the value of an associate rule can be obtained by this mean rather than from the explicit expression of the associate rule. For instance, denoting by the value obtained by a rule , one may compute the value of Simpson’s rule by a certain weighted mean of and , and consequently to be sure that in the interval , or , lies not only but also the value of the integral , whenever is a pair of companion rules.

The main features of our framework are illustrated by some examples given in Section 4.

2 Taylor and interpolatory rules

Firtsly, we recall the notion of a quadrature rule. Let be a sufficiently smooth functions on the interval . For , consider the linear space of all polynomials of degree .

Definition 2.1.

(Quadrature rule [2], p. 1)

A quadrature rule is an approximation of the integral obtained using values of (and/or its derivatives) on a discrete set of points in .

For the sake of simplicity we occasionally denote the functional simply by .

The two types of quadrature rules to be considered in this work are Taylor and interpolatory rules, which we briefly review.

Taylor’s rules

Let be an integer, , and assume that . The function can be written as the sum of the Taylor’s polynomial, centered at , and a remainder function , of the form

where the symbol denotes the open interval Integrating both sides in , we get


Assuming that the second term of the sum in (1) is not null, we call Taylor’s rule of order to


Thus, the error of is


Degree of a rule

By construction, a Taylor’s rule is exact when is a polynomial belonging to , that is the respective error is null. This is the reason why we say that is a rule of degree of precision at least . When a rule of degree at least is not exact for a monomial of we say that the rule has degree (of precision) , according to the following definition.

Definition 2.2.

(Degree of a quadrature formula) ([5], p. 157)

We say that a quadrature rule has degree (of precision) if the rule is exact for any polynomial , but it is not exact for a monomial of degree .

Interpolatory rules

Given distinct nodes in , say , consider the table of values . It is well known that there exists a unique polynomial interpolating the table. Assuming that , we have


and there exists , such that

Integrating both sides of (4) we obtain

Assuming that , we call


an interpolatory rule of order . The error of is given by


Comparing the error formulas (3) and (6) it is clear that it is easier to deal with the former. This is the reason why it seems more natural to start discussing quadrature rules by the Taylor type ones.

Whenever is a polynomial of degree , both rules in (2) and in (5) are exact. In both cases the expressions of their errors exhibit the -th derivative of , and there exist nonzero constants such that


We are interested in guaranteeing that the derivatives in an error formula do not change sign in , which lead us to consider the following assumptions.

Consider that and do not change sign in . That is,




When a function satisfies Assumption A, the sign of the errors of or depends only on the sign of the constants or in (7). This justifies the following definition of positive or negative rule.

Definition 2.3.

Let be a quadrature rule of degree , satisfying Assumption A in (8), such that the respective error is of the form

The rule is positive (resp. negative) if (resp. ).

A pair of rules of the same degree having errors of opposite signs are particularly interesting. Such rules will be called companion rules.

Definition 2.4.

(Companion rules)

Two rules and , of the same degree , having opposite signs are called companion rules.

From the error formulae of two companion rules one can deduce not only a new rule, which we call associate rule, but also its error expression as follows.

Without loss of generality assume that the rule is positive and the companion rule is negative. Concerning Taylor and interpolatory rules, there are positive integers and such that the respective error in (7) can be written as


Thus, adding (10) and (11) and simplifying we obtain


Associate rule

The sum in (12) shows that we can define a new rule, say , by

and the respective error is given by


Dividing the natural numbers and by its great common divisor, we obtain




Thus, the rule given by (14) is a weighted mean of the companion rules and . The weights and are irreductible positive rational numbers. We call the associate rule to the pair . Since such a weighted mean of the two real numbers lies between these numbers, the following inequalities holds,

3 Basic companion and associate rules

“The material equipment essential for a student’s mathematical laboratory is very simple. Each student should have a copy of Barlow’s tables of squares, etc., a copy of Grelle’s “Calculating Tables” and a seven place table of logarithms.” (Whittaker and Robinson [13], p. vi).

We now show that from the three basic Taylor’s rules (left rectangle, right rectangle and midpoint rule) we can define pairs of companion rules whose associate rules are of interpolatory type, in particular the widely used trapezoidal and Simpson rules. Thus, we automatically obtain error expressions for these associate rules, as in (13), which might be compared to the ones available in the literature. Furthermore, we obtain intervals, containing the exact value of , only taking into account to the properties of the arithmetic and weighted mean of two real numbers.

Denoting by the left rectangle rule, by the right rectangle rule (both Taylor’s rules of order 0) and by the midpoint rule (Taylor’s of order 1), we show that (trapezoidal rule) and (Simpson rule) are associate rules:

where the symbol is used to refer the associate rule to the pair of companion rules.

For the sake of completeness we show that the second order Taylor’s rule is companion to the Simpson’s rule and we obtain its associate as the weighted mean

The following table summarizes the main features of the companion and associate rules to be discussed in the next paragraphs.

Rule Associate rule Degree
1 3
3 3
Table 1: The notation refer to the sign of the rule .

The associate rule of is the trapezoidal rule

Let and consider the node or . The zero order Taylor expansion of at gives, respectively,

Integrating both sides in the above equations we obtain,


The left and right rectangle rules are implicitly defined in (16) and (17). Namely the respective expressions and errors are:


The above two rules are both of degree (see Def. 2.2). Under Assumption A, the rule is positive while is negative. The constants in (10)-(11) are and then . Thus, from (14) the associate rule to the pair is the rule


We denoted this associate rule by (instead of as in (14)) since it coincides with the well-known trapezoidal rule. This is a rule of interpolatory type with two nodes and . Using (13), the respective error formula is


The associate rule to is the Simpson’s rule

Let , and . The second order Taylor’s rule is obtained from

Integrating both sides of the above equality, we get


From (22) we recover the midpoint rule ,


whose error is given by the expression


Recall that the error of the trapezoidal rule ([12], Ch. 7) can be written as


Under Assumption A, from (22) and (24), we conclude that and are respectively positive and negative and have the same degree . So, they are companion rules. The corresponding values and in (12) are , , and . Therefore the values (see (15)) are and . Thus, the associate rule to the pair is Simpson rule


whose error formula is (see (13))


Since is positive, by (27) and (26), Simpson’s rule is a weighted mean of (M,T), the exact value belongs to the interval defined by the inequalities

Recall that the second expression in (26) coincides with the famous Simpson’s rule. It is worth mentioning that once computed by (22) and by (20), it is more efficient to obtain the value using the first formula in (26) rather than the second one.

In the following paragraph we need to consider the well-known error formula for Simpson’s rule. Let . We have


Thus, under Assumption A in (8), this rule in negative, and the respective degree is .

The associate rule to is a corrected midpoint rule

Let and be the midpoint of the interval, i.e., . Since

and taking into account that for any odd, the integration of both sides of the above equation, gives

We denote by the Taylor’s rule

whose error expression is

Recall from (28) that the error for the Simpson rule is

Under Assumption A in (8), the rule is positive while is negative. The constants in (10)-(11) are , , , and . So , , and by (14) the associate rule to is the rule


whose error expression has the form


Therefore, under Assumption B in (9), the rule is positive. It has the same degree as and . However, as the rule is the weighted mean (29) of and , the exact value lies in the interval defined by the inequalities


Composite rules

To obtain a composite version of a given simple rule , one divides the interval in parts with uniform length , and we apply to each subinterval and finally add the values obtained. We denote by the composite rule corresponding to the application of a simple rule to the subintervals , such that , , with .

4 Examples

The main features of our companion rules and associate ones can be illustrated by taking as models the following integrals:

The first integral is particularly interesting since the four composite rules and , with subintervals, are exact as shown in Example 1. Thus, the number can be materialized in 2D and 3D pictures as in Figures 1 and 3, suggesting potential architectural applications.

The numerical experiments in Examples 2 and 3 were carried out using Mathematica [14]. Commands like , e are useful to define composite rules (see code given in Example 2).

Example 1.
Figure 1: Four beautiful rules.



In Figure 1 the graph of , passing through the points A,D,C,E, and B is displayed in bold. The simple rules and are useless as approximations of the transcendental number , since

As and , we have

Taking into account that , the Taylor’s rule is

Recall that denotes a composite rule with subintervals of . The symmetry of the function with respect to the axis leads to the remarkable property that all the composite rules with subintervals, and the trapezoidal rule , produce the exact value of (32), that is, . The subintervals to be considered are and . Thus,

The simple Simpson’s rule ( subintervals) is not exact, as suggested by Figure 1 where the graphic of the interpolating polynomial passing trough the points A, C, B is displayed using a dashed line. It is obvious that the area delimited by the graph of the interpolating polynomial and the -axis is not the same as the area under the graph of . However, since the composite rule and are exact, the composite Simpson’s rule , with subintervals, should be exact because this rule is a weighted mean of and given by (26). In fact,


As shown previously that the simple Taylor’s rule is not exact. However, the composite rule with subintervals is. Let us consider first the subinterval . represents the area delimited by the -axis and the line segment (passing through the point D in Fig.1), whose cartesian equation is

Noting that , we have

Figure 2: The four beautiful rules and .

Analogously, in the subinterval , the value of represents the area delimited by the -axis and the line segment (passing through the point E in Fig.1), whose cartesian equation is

As , we obtain

Thus, the composite rule, with , subintervals gives

So, all the above six composite rules, , with , are exact for the integral (32). In Figure 2 four plane regions whose area is are shown, giving a geometrical interpretation of the rules , , and respectively.

Figure 3: Partial revolution around the axis.

In Figure 3 we show (partial) surfaces generated by the revolution of the graphic around the -axis together with the line segments (cf. Figure 1). This suggests interesting architectural applications of our companion and associate rules.

Example 2.


As the function is positive and its derivative is nonnegative derivative in , the function is an increasing function. Therefore, for each , the rules and have errors of opposite signs and



we have,

Thus, from (33) it follows

As the composite rule is the weighted mean (20) of and , one concludes that . Moreover, as is an increasing function, we also have for the midpoint rule

Consequently, all the rules have as common limit. The same is true for the Simpson rule since this is the weighted mean (26) between the composite companion rules (midpoint) and (trapezoidal).

Figure 4: Composite rules for .

In Figure 4 we compare the errors for each of the previous rules, including the Taylor’ s rule . For we firstly compute the 6-uple using the following Mathematica code

L[f_, a_, b_] := (b - a) f[a];
R[f_, a_, b_] := (b - a) f[b];
M[f_, a_, b_] := (b - a) f[(a + b)/2];
T[f_, a_, b_] := (b - a)/2 (f[a] + f[b]);
S[f_, a_, b_] := (2 M[f, a, b] + T[f, a, b])/3;
T2[f_, a_, b_] := M[f, a, b] + (b - a)^2/24 f’’[(a + b)/2];
composite[rule_String, a_, b_, n_] := Block[{h},
   h = (b - a)/n // N;
   Total[Map[ToExpression[rule][f, #[[1]], #[[2]] ] &,
      Partition[Range[a, b, h], 2, 1]]    ] ];

The numerical values obtained from the 6 rules are sorted in increasing order. For each , the second column of Figure 4 displays a string reflecting the names of the rule with respect to the order of the computed values. For instance the string LMSTT2R means that the smaller computed value is given by the (composite) left rectangle rule and the greatest one corresponds to the right rectangle rule . The values in the columns Error Xi refer to the error of the rule in the -th position of the respective string of rules names.

All the error columns in Fig. 4 show that the respective rule produce monotone sequences. Also, it is clear that and are pairs of companion rules. As the absolute error of is less than the one of , Simpson’s rule performs better than Taylor’s and all the other rules.

Example 3.


Figure 5: Composite rules for .

In this case is a positive function, symmetric with respect to the -axis. The function increases from to and decreases from to . Both the function and its derivatives are bounded in . As shown in Figure 5, for the composite rules and (midpoint) have errors of opposite sign, whilst for the rules and enjoy the same property. For all 6 rules their absolute errors seem to approach zero, as expected.

One can verify that for the Simpson’s rule gives , where all digits are correct.


  • [1] M. Abramowitz, I. A. Stegun, Handbook of Mathematical Functions with Formulas, Graphs and Mathematical Tables, Dover, 1972.
  • [2] H. Engels, Numerical quadrature and cubature, Academic Press, London, 1980.
  • [3] P. J. Davis, P. Rabinowitz, Methods of Numerical Integration, Academic Press, Orlando, 1984.
  • [4] C. F. Gauss, Methodus nova integralium valores per approximationem inveniendi, Commentationes Societatis Regiae Scientarium Gottingensis Recentiones 2, [Werke III], 123-162, 1812.
  • [5] W. Gautschi, Numerical Analysis, An Introduction, Birkhauser, Boston, 1997.
  • [6] M. M. Graça, Regras companheiras de Simpson-Milne, Boletim da Sociedade Portuguesa de Matemática, (in portuguese, to appear).
  • [7] V. I. Krylov, Approximate Calculation of Integrals, Dover Pub., New York, 2005.
  • [8] A. R. Krommer, C. W. Ueberhuber, Computational Integration, SIAM, Philadelphia, 1998.
  • [9] I. Newton, Treatise of the Quadrature of Curves, in Sir Isaac Newton’s Two Treatises of The Quadrature of Curves, and Analysis by Equations of an infinite Number of Terms, by John Stewart, James Bettenham, London, 1745.
  • [10] S. Nikolski, Fórmulas de Cuadratura, Editorial MIR, Moscú, 1990 (spanish version).
  • [11] A. H. Stroud, D. Secrest Gaussian Quadrature Formulas, Prentice-Hall, Englewood Cliffs, N. J., 1966.
  • [12] E. Suli, D. Mayers, An Introduction to Numerical Analysis, Cambridge University Press, New York, 2003.
  • [13] E. T. Whittaker, G. Robinson, The Calculus of Observations, 3rd. ed., Blackie and Son, London, 1942.
  • [14] S. Wolfram, The Mathematica Book, Wolfram Media, fifth ed., 2003.