 # High degree quadrature rules with pseudorandom rational nodes

After introducing the definitions of positive, negative and companion rules, from a given pair of companion rules we construct a new rule with higher degree of precision The scheme is generalized giving rise to a transformation which we call the mean rule. We show that the mean rule is the best approximation, in the sense of least-squares, obtained from a linear combination of two rules of the same degree of precision. Finally, we show that a rule of degree 2k+1 can be constructed as linear combination of k+1 rules of degree one and rational pseudorandom nodes. Several worked examples are presented.

## Authors

##### 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

Given two quadrature rules and with the same degree of precision , we begin by proposing a scheme to construct a new rule of higher degree. One desirable assumption is that the rules and are companion, in the sense that one can assign opposite signals to the respective error. In particular, we show that the basic quadrature rules known as midpoint, trapezoidal, and Simpson rules can all be obtained as linear combinations of companion rules of lower degree of precision. The theoretical background applied in this work relies on the method of undetermined coefficients (, p. 565), ( p. 170).

We generalize the referred scheme by presenting a rule transformation (defined in the set of rules of degree ), which to a pair of rules of , assigns a new rule of greater degree. This leads to an algorithm to obtain quadrature rules of arbitrary order of precision, as suggested in the worked examples. The rule is called the mean rule since it is a weighted mean of and . It can be seen as a least-squares best approximation as discussed in paragraph 4.1.

The main results of this paper are discussed in Section 5. We first show that if one takes a set of of open rules of degree one, , whose first member is the midpoint rule and the other members have two symmetrical rational nodes, there exists a unique linear combination of the rules such that the combined rule has degree (see Proposition 3). As an illustration we apply the composite version of the rule to obtain approximations of with 60 significant digits (Example 8) using the model function .

Finally we show that one can expand the scheme considering combined rules where the nodes of the -degree starting rules are pseudorandom rational numbers (paragraph 5.1). In particular, we use a pseudorandom -degree combined rule giving an approximation of with more than significant digits as detailed in Example 9.

## 2 Notation and definitions

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

Without loss of generality, we consider to be the interval of integration and we will denote by a general quadrature rule to approximate the integral .

Note that a rule , defined in , can be rewritten for the interval as , through a change of variable defined by the bijection

 σ(t)=a+b−a2(t+1),−1≤t≤1

where

The monomials , are denoted by , for .

###### Definition 2.1.

(Degree of rule)

Let be an integer, ,

for odd

and , for even , and let

 μm+1=∫1−1ϕm+1(t)dt.

A rule is of degree if it is exact for , with , but not exact for , that is,

 ⎧⎪ ⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪ ⎪⎩Q(ϕ0)=μ0Q(ϕ1)=μ1⋮Q(ϕm)=μm,

but

 Q(ϕm+1)≠μm+1 .

In what follows,

(a.k.a. the principal moment) plays a key role and we shorten its notation to

 μ=∫1−1ϕm+1(t)dt=2m+2 . (1)
###### Definition 2.2.

(Sign of a rule)

Let be a quadrature rule of degree , such that

 γQ=μ−Q(ϕm+1) .

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

A pair of rules of the same degree whose respective value have opposite signs are rules of particular interest. Such rules will be called companion rules.

###### Definition 2.3.

(Companion rules)

Two rules and , of the same degree , such that and have opposite signs are called companion rules.

## 3 Linear combination of two rules

We now address the problem of combining a pair of companion rules and show that the resulting rule is not only a weighted mean of the two rules considered but also it has higher degree of precision. An obvious advantage of this approach is that at a minor computational cost, the value of the new rule can be closer to the integral than the values of the rules of the starting pair (see Example 2).

###### Proposition 1.

Let and be two rules both of degree , such that

 μA=A(ϕm+1)≠μB=B(ϕm+1), (2)

and consider the linear combination of the rules

 Y(g)=μ−μBμA−μBA(g)+μA−μμA−μBB(g), (3)

where is the principal moment in (1). Then, the degree of the rule is at least .

###### Corollary 1.

If and are companion rules of degree , such that

 μB<μ<μAorμA<μ<μB,

then the combined rule (3) has degree at least and

 A(g)≤Y(g)≤B(g)orB(g)≤Y(g)≤A(g) . (4)
###### Proof of Proposition 1.

Both rules are exact for , with , that is, . Therefore,

 Y(ϕj)=μ−μBμA−μBA(ϕj)+μA−μμA−μBB(ϕj),=μ−μB+μA−μμA−μBI(ϕj)=I(ϕj) .

So, the rule has degree at least . It remains to show that this rule is exact for which implies that its degree is at least . From (2), we have

 Y(ϕm+1)=μ−μBμA−μBμA+μA−μμA−μBμB,=μμA−μμBμA−μB=μ=I(ϕm+1) .

###### Proof of Corollary 1.

We assume that is positive and is negative being the proof in the other case completely analogous. By definition of sign of a rule, we have and , i.e.

 μA<μ<μB.

Let and which implies . The rule can be written as

 Y(g)=αA(g)+βB(g)α+β,

where

 c1=αα+β>0andc2=βα+β>0,

So, the rule is a linear combination of the rules and with positive coefficients and . Consequently, the inequalities in (4) hold, and the rule is a weighted mean of the companion rules and . ∎

###### Example 1.

()

The well-konown midpoint and trapezoidal rules are, respectively,

 M(g)=2g(0),T(g)=g(−1)+g(1). (5)

For , the principal moment is

 μ=∫1−1ϕ2(t)dt=2/3 .

Since and , we have

 γM=μ−M(ϕ2)=2/3>0andγT=μ−T(ϕ2)=−1/3<0 .

Thus, by Definition 2.2, is positive, while is negative. Moreover, as , the rules and are companion rules (see Definition 2.3).

Let us show that the linear combination (3) of these two rules of degree 1 coincides with the Simpson rule, which is a rule of degree .

As and , from (3) it follows

 Y(g)=μ−μTμM−μTM(g)+μM−μμM−μTT(g)=23M(g)+13T(g).

Taking into account the expressions (5), we get

 Y(g)=13[g(−1)+4g(0)+g(1)],

which coincides with Simpson rule (see next example).

###### Example 2.

(A combined rule of degree 5 using the Simpson rule )

One easily verifies that in the (open) rule

 A(g)=g(−√33)+g(√33),

and the Simpson rule (closed)

 S(g)=13(g(−1)+4g(0)+g(1)),

are both of degree . Let us show that they are companion rules, and verify that the respective combined rule (3) has degree .

The principal moment is , and

 μA=A(t4)=2/9⟹γA=μ−A(ϕ4)=8/45>0μS=S(t4)=2/3⟹γS=μ−S(ϕ4)=−4/15<0,

and so is positive while is negative. We have and the rule has the form

 Y(g)=γSμA−μSA(g)−γAμA−μSS(g)=3A(g)+2S(g)5. (6)

The explicit expression of the weighted mean (6) is

 Y(g)=115[2g(−1)+9g(−√3/3)+8g(0)+9g(√3/3)+2g(1)] . (7)

The rule has degree since

 Y(ϕ4)=2/5andI(ϕ4)=2/5,Y(ϕ5)=0andI(ϕ5)=0,Y(ϕ6)=14/45≠I(ϕ6)=2/7 .

The result in (7) shows the dependence of on 5 nodes. In paragraph 3.2 we will construct another rule of degree 5 using only 3 nodes.

In computational terms, given two rules and one does not need to use the expression of the rule in terms of the nodes like in (7) but just the linear combination (6).

In order to observe the numerical improvement one can get passing from a pair of companion rules to the respective combined rule , let us approximate the following integral which will be used as a test model in the subsequent examples:

 I(g)=∫1−121+t2dt=π .

For the first rule we obtain , for the Simpson rule and for the combined rule . Thus, the respective errors are

 EA(g)=I(g)−A(g)≃0.14,ES(g)=I(g)−S(g)≃−0.19,

while Once computed and the cost for computing is only an addition, two multiplications and a division. In this example an relative error in and yields to a relative error of of the rule , meaning that the combined rule is approximately 15 times more accurate than the two referred companion rules.

### 3.1 Families of companion two-point rules

Let be two distinct nodes belonging to , and the two-point quadrature rule

 Q(g)=A0g(t0)+A1g(t1), (8)

where the parameters , will be determined in order that the rule has a degree of precision at least 1.

Facts:

1. There are infinite choices of points in the square region , for which the rule (considered as a function of ) is either positive or negative and simultaneously has degree 1;

2. There are more positive rules than negative ones;

3. The points for which has exact degree , lie on the hyperbole ,

 L2:1/3+t0t1=0. (9)
4. There is exactly one (two-point) rule with degree , namely for , , that is given by

 Q(g)=g(−√33)+g(√33). (10) Figure 1: Rules of degree 1: positive (gray) and negative (white).

In Figure 1 the points in the square region for which the rule is either positive or negative are displayed in gray and white respectively. The boundary of this region contains points of the hyperbole in (9). For belonging to the hyperbole the rule has exactly degree one, meaning that there is an infinite number of rules of -degree each one with nodes for which the point belongs to one of the two branches of the hyperbole in Figure 1. Moreover, one immediately sees that the two-point closed Newton-Cotes rule ( and ) is a negative rule of order one, as it was assumed in Example 1. It is also worth to recall that any closed Newton-Cotes rule of any degree is negative as well, whereas the open Newton-Cotes rules are all positive.

The mathematical aspects behind the facts - above and the geometry of figures 1-2 can be explained as follows.

Instead of the canonical polynomial basis of monomials of degree , we consider the basis

 Ψ0(t)=1Ψ1(t)=(t−t0)Ψ2(t)=(t−t0)(t−t1)(nodal polynomial)Ψ3(t)=(t−t0)2(t−t1) .

Imposing the condition that the rule is of degree at least 1, the parameters in (8) are computed. That is, considering and , we obtain the following triangular system in the unknowns :

 {A0+A1=2(t1−t0)A1=−2t0, Figure 2: Rules of degree ≥2: positive (dark gray) and negative (light gray).

The solution of this system is and . Consequently, the two-point rule

 Q(g)=2t1t1−t0g(t0)−2t0t1−t0g(t1),t1≠t0

has degree at least one.

The rule applied to the nodal polynomial gives , whereas the moment . So,

 γQ=μ−Q(Ψ2)=μ=23+2t0t1 .

Thus, the rule is of degree one and positive for the points displayed in gray color in Figure 1 and negative for the white points.

###### Remark 1.

One advantage of the polynomial basis is that from the nodal polynomial onwards the rule is null and so the value of the parameter coincides with . This is the reason why we call the principal moment of the rule which also gives the sign of a rule in the sense of Definition 2.2.

The rule has degree if and only if (9) holds and it has null moment . The rule has degree 2 and is positive when and negative otherwise. The condition is given by the equation

 L3:4t03+2t13+2t20t1=0 . (11)

In Figure 2, the points for which (positive rule of degree 2) are displayed in dark gray and in light gray the points with (negative rule). The boundary of the respective domains is shown in dark bold. This boundary is the algebraic curve defined by a cubic polynomial as in (11).

The intersection points of the curves and are symmetrically distributed with respect to the origin and are given by , with . In figures 1-2 these intersection points are the center of the circles in blue.

This fully justify the facts -. Analogous procedures enable us to obtain the geometry of a family of rules with three distinct nodes. Indeed, following the same lines as above, we will obtain a famous (positive) rule of degree 5, known as Gauss-Legendre rule (see for instance , Ch. 6) with three nodes, which might be be combined with the 5 degree rule given in Example 2.

### 3.2 Families of companion three-point rules

In , we consider the set of 3-point quadrature rules

 Q(g)=A0g(t0)+A1g(t1)+A2g(t2),wheret0≠t1≠t2 .

Firstly, we obtain the weights in order that all the rules in the set have degree 2 and are either positive or negative. This will enable us to find candidates to pairs of companion rules of degree 2.

The weights can be written as functions , for . In fact, taking the polynomials

 Ψ0(t)=1Ψ1(t)=t−t0Ψ2(t)=(t−t0)(t−t1),

the rule has degree if and only if it is exact for and . That is, the weights are solution to the triangular system

 ⎧⎪⎨⎪⎩A0+A1+A2=I(Ψ0)(t1−t0)A1+(t2−t0)A2=I(Ψ1)(t2−t0)(t2−t1)A2=I(Ψ2).

Since we are assuming , this system has a unique solution,

 A2=Ω2(t0,t1,t2)=I(Ψ2)(t2−t0)(t2−t1)A1=Ω1(t0,t1,t2)=I(Ψ1)−(t2−t0)A2(t1−t0)(t2−t1)A0=Ω0(t0,t1,t2)=2−(A1−A0) . (12)

Thus,

 Q(g)=Ω0(t0,t1,t2)g(t0)+Ω1(t0,t1,t2)g(t1)+Ω2(t0,t1,t2)g(t2), (13)

where are given by (12). After some simplifications the expressions in (12) become

 Ω0(t0,t1,t2)=2(1+3t1t2)3(t1−t0)(t2−t0)Ω1(t0,t1,t2)=−2(1+3t0t2)3(t1−t0)(t2−t1)Ω2(t0,t1,t2)=2(1+3t0t1)3(t2−t0)(t2−t1) . (14)

Now, let us consider the polynomials

 Ψ3(t)=(t−t0)(t−t1)(t−t2)(nodal% polynomial)Ψ4(t)=Ψ3(t)(t−t0)Ψ5(t)=Ψ4(t)(t−t1).
###### Remark 2.

Note that the rule (13) is null when applied to , for , and so the degree of the rule is the same of the first index for which . Figure 3: Region giving positive rules of degree 2. The symmetrical 6 points ±(0,√3/3,−√3/3) , ±(√3/3,0,−√3/3), ±(√3/3,−√3/3,0) belong to the boundary of the region. For points A and B see Example 3. For the points L1 and L2 see Example 4.

By construction, the rule has order

. Therefore, for any polynomial of the vector space

(polynomials of degree ) the rule is exact. In particular, it is exact for the elements of the canonical basis of , that is for , with .

Since , we have , where Thus, has order exactly 2 if and order if .

Let be the following polynomial

 P(t0,t1,t2)=t30Ω0(t0,t1,t2)+t31Ω1(t0,t1,t2)+t32Ω2(t0,t1,t2), (15)

where are given by (14).

The rule (13) is:

1. positive if ;

2. negative if ;

3. of degree if is a root of the polynomial equation .

Specific instances of the rule (13) with weights (14) are given in the following example.

###### Example 3.

Let , (see Figure 3 where the point has coordinates111After defining the polynomial expression (15), the coordinates of the point A have been found using the predicate as argument to the Mathematica  command FindInstance. ) and as in (15). Computing the ’s, given by (14) we get . Therefore the rule

 A(g)=29[760g(−15/16)−1194g(−7/8)+443g(−3/4)],

is positive, with degree 2.

Considering now and (point in Figure 3) we have . Thus, the rule

 B(g)=1117[95g(3/4)−264g(−7/8)+403g(−3/4)],

is negative, with degree 2. Taking , the coefficients (3) of the combined rule are:

 μ=I(ϕ3)=0μA=A(ϕ3)=−2257/786(as μ−μA>0 the rule A(g) is% positive)μB=B(ϕ3)=2975/19984(as μ−μB<0 the rule B(g) is negative) .

As and have errors of opposite sign they are companion rules (see Definition 2.3). The combined rule is

 Y(g)=297532316A(g)+2934132316B(g),

which coincides with the (open) 4-point rule

 Y(g)=4522000g(−15/16)−7659522g(−7/8)+3545421g(−3/4)+214415g(3/4)290844 .

It can be verified that , for , and

 I(ϕ4)−Y(ϕ4)=−58075361/220610560<0 .

Thus the combined rule is negative and of degree .

As an exercise, the interested reader can verify that for any of the points referred in Figure 3 the corresponding rule in (13) has degree 3. Thus, one may conclude that there exists an infinite set of rules of the referred type which are negative and of degree 3. Consequently, as all rules belonging to the set of open Newton-Cotes rules, , are positive, so they are good candidates to use in pairs of companion rules in order to obtain combined rules of arbitrary order.

###### Example 4.

(-point Gauss-Legendre rule of degree 5)

A simple choice of nodes and for the weights (14) of the rule (13) is , and , giving

 Q(g)=13t20g(t0)+3t20−13t20g(0)+13t20g(−t0) . (16)

For the polynomials , with , Table 1 displays the errors . The rule has degree if and only if , that is, for . In this case the rule in (16) becomes

 Q(g)=59g(−√35)+89g(0)+59g(√35) . (17)

Taking into account the values of and , the rule (17) has degree 5 and is positive. This is the Gauss-Legendre rule with 3 nodes. In Figure 3, the points and correspond to the nodes for which the rule has degree 5.

## 4 The mean transformation rule W(g)

In what follows, denotes the set of rules with degree . In Proposition 1, a new rule has been assigned to a pair of companion rules belonging to . In order to generalize this scheme, let us define a transformation

 W:Q×Q→Q(A,B)↦W(g),

where will enjoy analogous properties of the linear combination in (3), in the sense that the rule has degree greater than those of the arguments and . The rule will be called mean rule.

As before, for a given rule , we compute the quantities and , defined by

 μ=∫1−1ϕm+1(t)dtandμQ=Q(ϕm+1), (18)

where .

###### Definition 4.1.

(Mean rule)

Let be the set of rules of degree and belonging to . The mean rule of and is

 W(g)=⎧⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪⎩A(g)+B(g)2,ifμA=μB(m+2)μB−2(m+2)(μB−μA)A(g)+2−(m+2)μA(m+2)(μB−μA)B(g),if% μA≠μB (19)

where and are as in (18).

###### Proposition 2.

The mean rule (19) has degree at least .

###### Proof.

As the rules and have degree , we know that , for odd , and

 A(ϕj)=B(ϕj)=∫1−1ϕj(t)dt=2j+1,j=0,2,4,…,m . (20)

In the case , from (20), it follows

 W(ϕj)=A(ϕj)+B(ϕj)2=I(ϕj),forj=0,1,…,m,m+1.

So, has degree .

When , let us show that there exists a unique pair such that

 W(g)=αA(g)+βB(g),α,β∈R,

has degree .

For , substituting in by each and applying (20), we obtain the linear system

 {α+β=1μAα+μBβ=μ .

Since this system has the unique solution

 α=(m+2)μB−2(m+2)(μB−μA),andβ=2−(m+2)μA(m+2)(μB−μA) .

Thus, has degree at least . ∎

###### Example 5.

We now construct the mean rule of (10) and the Simpson’s rule (both rules of degree 3) and show that the mean rule has degree 5. The starting rules will be denoted by and , respectively:

 A(g)=g(−√3/3)+g(√3/3),S(g)=1/3(g(−1)+4g(0)+g(1)) .

We have,

 μ=I(ϕ4)=2/5,μA=A(ϕ4)=2/9,μS=S(ϕ4)=2/3,andμS−μA=4/9 .

Thus,

 W(g)=5μS−2