A geometrical interpretation of the addition of nodes to an interpolatory quadrature rulewhile preserving positive weights

A novel mathematical framework is derived for the addition of nodes to univariate and interpolatory quadrature rules. The framework is based on the geometrical interpretation of the Vandermonde matrix describing the relation between the nodes and the weights and can be used to determine all nodes that can be added to an interpolatory quadrature rule with positive weights such that the positive weights are preserved. In the case of addition of a single node, the derived inequalities that describe the regions where nodes can be added are explicit. Besides addition of nodes these inequalities also yield an algorithmic description of the replacement and removal of nodes. It is shown that it is not always possible to add a single node while preserving positive weights. On the other hand, addition of multiple nodes and preservation of positive weights is always possible, although the minimum number of nodes that need to be added can be as large as the number of nodes of the quadrature rule. In case of addition of multiple nodes the inequalities describing the regions where nodes can be added become implicit. It is shown that the well-known Patterson extension of quadrature rules is a special case that forms the boundary of these regions and various examples of the applicability of the framework are discussed. By exploiting the framework, two new sets of quadrature rules are proposed. Their performance is compared with the well-known Gaussian and Clenshaw–Curtis quadrature rules, demonstrating the advantages of our proposed nested quadrature rules with positive weights and fine granularity. © 2021 The Author(s). Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).


Introduction
This article is concerned with the addition of nodes to univariate and interpolatory quadrature rules with positive weights. If such a quadrature rule is given, the goal is to determine all sequences of nodes such that, upon adding all nodes from such a sequence to the rule, an interpolatory quadrature rule with positive weights is again obtained. The motivation of this problem is twofold. Firstly, approximations of integrals computed using interpolatory quadrature rules with positive weights converge for any absolute continuous function [1][2][3]. Secondly, nested quadrature rules allow for straightforward refinements of the quadrature rule approximation, which is especially relevant if the integrand is computationally expensive.
Possibly the best-known interpolatory quadrature rule is the Gaussian quadrature rule [4], which exists for virtually any probability distribution with finite moments. It has positive weights and maximal polynomial degree. However, the nodes are not nested. The Gauss-Kronrod quadrature rule is an extension of a Gaussian quadrature rule, such that two nested rules with positive weights are obtained [5,6]. The Gauss-Kronrod-Patterson quadrature rule [7,8] further extends this idea by repeatedly applying the same algorithm, such that a sequence of nested rules is obtained. However, it does not exist for any distribution [9,10]. Even though many other extensions have been proposed over the years [11][12][13], in general it is difficult to obtain a series of nested quadrature rules with positive weights. Moreover often the smallest possible granularity between two consecutive nested quadrature rules can only be found by exhaustive search [14].
Another large group of well-known quadrature rules is formed by the Clenshaw-Curtis quadrature rules [15], or simply those quadrature rules that are based on Chebyshev approximations (the Clenshaw-Curtis rule is formed by the Chebyshev extrema). Besides having excellent interpolation properties [16], it is well-known that these quadrature rules have positive weights if the distribution under consideration is uniform (explicit expressions are known [17]). Moreover for non-uniform distributions, the condition number of the quadrature rule converges to unity [3]. However, the vanilla Clenshaw-Curtis nodes are only nested for exponentially growing numbers of nodes [18].
Both the Gaussian and Clenshaw-Curtis quadrature rules have explicitly predefined nodes based on the roots of orthogonal polynomials. This results in accurate quadrature rules, but the construction of an accurate nested quadrature rule with fine granularity based on these rules remains notoriously difficult.
In this article the goal is to propose a geometrical framework for the addition of nodes to an interpolatory quadrature rule with positive weights and use this framework to determine all interpolatory quadrature rules with positive weights that extend a rule based on predefined nodes. It will be demonstrated rigorously that the boundary of the set that contains all nodes that can be added is equivalent to the Patterson extension of quadrature rules, such that a special case of the framework is an extension of the aforementioned Gaussian quadrature rule families.
The approach taken is based on the geometrical interpretation of the linear system describing the nodes and the weights [19][20][21], which yields a necessary and sufficient condition for a quadrature rule to have positive weights. The framework embeds previous results on the removal of nodes from quadrature rules [19,22,23] and describes, besides a geometrical description of all nodes that can be added to a quadrature rule, algorithms that can be used to construct and modify interpolatory quadrature rules with positive weights.
The addition and replacement of a single node can be determined analytically, whereas numerical methods are required to determine the bounds on the sets describing multiple nodes. The focus of this article is mainly on the geometrical and mathematical aspects and not on the numerical aspects of the proposed algorithms. However, to illustrate the potential of the framework, two straightforward examples of quadrature rules with positive weights that can be constructed by exploiting the proposed techniques are discussed.
In Section 2 the nomenclature used in this article is discussed, including the motivation behind enforcing positive weights. In Section 3 the problem of adding a single node to a quadrature rule is considered, which can be solved analytically. It is not always possible to add a node to a quadrature rule such that the resulting rule has positive weights. Therefore the theory is extended to adding multiple nodes in Section 4, where the results developed for adding a single node will be used extensively. It is always possible to add multiple nodes to a quadrature rule, provided that any number of nodes may be added to the rule. To demonstrate the advantages of nested quadrature rules with positive weights, two quadrature rules that are derived in this work are compared with the well-known Gaussian and Clenshaw-Curtis quadrature rule. The details and results of this numerical experiment are discussed in Section 5. Conclusions and suggestions for future work are discussed in Section 6.

Preliminaries
The quadrature rule nomenclature relevant for this article is discussed in Section 2.1. The relevance of positive weights and the relation between positive weights and accuracy of a quadrature rule are briefly reviewed in Section 2.2. The mathematical notion of adding nodes to a quadrature rule can be interpreted as a non-trivial extension of the removal of nodes [19,22,23], which is briefly discussed in Section 2.3. Finally, the problem setting of this article and the main results obtained from this work are summarized mathematically in Section 2.4.

Nomenclature
A quadrature rule is a well-known approach to approximate a weighted integral in the interval Ω = [a, b] ⊂ R with −∞ ≤ a < b ≤ ∞. The weighting function is a positive density function ρ: Ω → [0, ∞). The main interest is to approximate the integral over a given continuous function u: Ω → R, i.e. to approximate the following operator: A quadrature rule approximates this integral by means of a weighted average, consisting of nodes and weights, which we denote by X N = {x 0 , . . . , x N } ⊂ Ω and W N = {w 0 , . . . , w N } ⊂ R respectively. The quadrature rule is the following operator A N : It is common to measure the consistency of this construction by means of polynomial degree. The polynomial degree of a quadrature rule is defined as the maximum polynomial degree the quadrature rule integrates exactly, or equivalently: a quadrature rule of degree K has the property A N ϕ = Iϕ, for all ϕ ∈ P(K ), (2.1) where P(K ) denotes the space of all univariate polynomials of degree K or less. This definition is only meaningful if ρ has finite moments, so that is assumed to be the case throughout this article.
A quadrature rule is called interpolatory if the dimension of P(K ) is larger than or equal to the number of nodes, or in other words, if K ≥ N. Such quadrature rules can be formed by integrating the polynomial interpolant of u using the nodes X N . As the title of this article suggests, these quadrature rules are the main focus of this work: throughout this article the interest is mainly in rules with K = N (though quadrature rules with K > N, such as the Gaussian quadrature rules, will also be considered).
The operators A N and I and the space P(K ) are linear, so if K = N, (2.1) defines a linear system that can be used to determine the weights, given the nodes and the moments of the distribution. Throughout this article a monomial basis of P(K ) is considered. In this case, the matrix of the linear system is the well-known Vandermonde matrix, denoted as follows: with µ k the raw moments of ρ: Throughout this article it is assumed that µ k is known exactly for all k. The notation V (X N ) is used for the matrix of this linear system. It is well-known that such that, given the nodes, (2.2) defines a unique solution of the weights provided that all nodes are distinct.

Accuracy of quadrature rules
In this article the focus is on constructing interpolatory quadrature rules with non-negative weights (which we will call with a little abuse of nomenclature a positive quadrature rule). An approximation of an integral by means of such a quadrature rule converges if the integrand is sufficiently smooth [1], which can among others be demonstrated by applying the Lebesgue inequality [3], provided that Ω is bounded. To this end, let u be given and let ϕ N be the best approximation polynomial [24] of degree N of u, i.e. ϕ N = arg min ϕ∈P(N) ∥ϕ − u∥ ∞ . Then Here, it holds that where it is used that |w k | = w k . Hence the following inequality is obtained: This shows many similarities with the classical Lebesgue inequality [16,24] and demonstrates that if u can be approximated well using a polynomial, it can be integrated using a quadrature rule with positive weights. Similar results exist for unbounded Ω [3,25].
Two well-known interpolatory quadrature rules with positive weights are the Clenshaw-Curtis and Gaussian quadrature rules.
The Clenshaw-Curtis quadrature rule [15] has nodes X N that are defined as follows for Ω = [−1, 1]: , for k = 0, . . . , N. (2.5) The Clenshaw-Curtis quadrature rule has positive weights if the uniform distribution is considered and for any other distribution with bounded support the sum of the absolute weights becomes arbitrary close to µ 0 for large N [3]. The quadrature rule is nested for specific levels: it holds that X N L ⊂ X N L+1 with N L = 2 L (for L = 1, 2, . . . ).
The nodes of the Gaussian quadrature rule [4] are defined as the roots of the orthogonal polynomials with respect to the distribution ρ under consideration, e.g. Legendre polynomials for the uniform distribution, Jacobi polynomials for the Beta distribution, etc. The uniquely defined rules always have positive weights and with N + 1 nodes the rule has degree 2N + 1, however the rules are not nested.
The Gauss-Kronrod and Gauss-Patterson quadrature rules are extensions of Gaussian quadrature rules such that upon adding M nodes (with M = N + 2 for the Gauss-Kronrod rule) to a rule of N + 1 nodes, a (not necessarily positive) rule of degree N + 2M is obtained [5,8]. The Patterson extension is also applicable to non-Gaussian quadrature rules, though possibly complex-valued nodes can be obtained. The idea is to solve the following problem for x N+1 , . . . , x N+M , given quadrature rule nodes X N : Then the obtained rule has degree N +2M [3,Theorem 5.1.3], is defined uniquely, and possibly has complex-valued nodes. By construction, a Gaussian quadrature rule is obtained if M = N + 1 (the weights of the nodes in X N become zero). These rules are reobtained as a special case in the framework discussed in this work.

Removal of nodes
The primary focus of this article is on the addition of nodes, but the obtained mathematical expressions can be interpreted as reversing the removal of nodes from an existing quadrature rule. Using Carathéodory's theorem, it can be shown that for each positive interpolatory quadrature rule X N , W N there exist two nodes x k 0 and x k 1 such that X N \ {x k 0 } and X N \ {x k 1 } both form the nodes of interpolatory quadrature rules with positive weights [19,22,23,26]. The details are discussed in the constructive proof of the following theorem.
Proof. The vectors v 0 , . . . , v N are linearly dependent, since these are N + 1 vectors spanning an N-dimensional space.
Hence there exists a vector c = (c 0 , . . . , Hence for any α ∈ R, we have that In particular, consider the following α and k 0 : With these choices it holds that a k − αc k ≥ 0 for all k and a k 0 − αc k 0 = 0, concluding the proof as follows: The theorem can be used straightforwardly to remove nodes from a quadrature rule. To this end, let the positive interpolatory quadrature rule X N and W N be given. The goal is to construct an interpolatory quadrature rule using N nodes from X N (which consists of N + 1 nodes). Therefore, let v 0 , . . . , v N be the columns of the Vandermonde matrix Then v k are N + 1 vectors spanning an N-dimensional space. The proof of Carathéodory's theorem yields that there exist a vector c, scalar α, and index k 0 such that Moreover, we have that w k 0 − αc k 0 = 0, so by using positive interpolatory quadrature rule is obtained. Notice that the vector c is computable, since it is a null vector of the This approach can be used to compute nested quadrature rules, but limits the accuracy of those quadrature rules to the initial rule of which nodes are removed. It is of less use if this rule is inadequately accurate or if no such rule is available. A possible approach to alleviate this is to use random samples as initial quadrature rule [27], though such samples do not accurately integrate higher order moments. The necessity of an existing quadrature rule is one of the main motivations to consider the addition of nodes, since that does not require the computation of an initial quadrature rule of sufficient accuracy.

Problem setting and main results
The problem studied in this article is how to add nodes to a positive interpolatory quadrature rule such that it remains positive and interpolatory. To formulate this mathematically, let a positive interpolatory quadrature rule X N , W N be given. Then the goal is to determine, for given M, all nodes such that the set X N+M contains the nodes of a positive interpolatory quadrature rule and such that the rules are nested, i.e. X N ⊂ X N+M . To keep the nomenclature concise, we will refer to this problem as adding M nodes to a positive interpolatory quadrature rule, where by ''adding'' we always mean addition such that the resulting quadrature rule has positive weights. Moreover the number of nodes added to a quadrature rule should be minimal, so we are also interested in the minimal value of M (with M > 0) such that a positive interpolatory quadrature rule with nodal set X N+M exists.
If a positive quadrature rule is given that is not interpolatory, i.e. a quadrature rule such that A N ϕ = Iϕ for all ϕ ∈ P(K ) with K < N, a positive interpolatory quadrature rule can be deduced from this rule by repeatedly applying Theorem 1.
Therefore we assume in this article without loss of generality that all quadrature rules are interpolatory.
The approach is to formulate, for given M, a necessary and sufficient condition for all M nodes that can be added. This condition can be used firstly to determine whether such nodes exist for a specific M and secondly to determine the nodes themselves. Moreover the derived theory allows for specific adjustments of quadrature rules. These adjustments consist of replacing and removing nodes from the quadrature rule, in such a way that the degree of the rule is not affected.
The analysis is split into two sections. The addition of a single node (M = 1) can be solved analytically and is discussed in Section 3. The addition of multiple nodes (M > 1) can only be done analytically for special cases. Based on the theory for M = 1, this problem is analyzed in Section 4.

Addition of one node
Let X N , W N be a positive interpolatory quadrature rule. The goal is to determine all x N+1 such that X N+1 = X N ∪ {x N+1 } forms the nodal set of a positive interpolatory quadrature rule, i.e. there exists a set of non-negative weights W N+1 such that Here, w (N+1) k are the weights in the set W N+1 and µ j is assumed to be known. Notice that in general W N and W N+1 will completely differ, so we use the following notation for any N: 0 , . . . , w (N) N }. Moreover, with a little abuse of notation we will use w (N) In Section 3.1 we derive a necessary and sufficient condition for such an x N+1 to exist, which depends on the current nodes, weights, and moment µ N+1 . As such, the developed theory provides practical adjustments of a quadrature rule.
These constitute addition and replacement of a node, without reducing the degree of the interpolatory quadrature rule. The details are discussed in Section 3.2 and will be very useful in the remainder of this article. In Section 3.3 the Patterson extension is discussed in light of the derived adjustments and some basic applications of the derived procedures are discussed, including the construction of a (partially) nested quadrature rule with positive weights.

Positive weight criterion
The key notion is that if the node x N+1 is given, a vector c = (c 0 , . . . , c N+1 ) T can be constructed such that w (N+1) k = w (N) k + c k (for k = 0, . . . , N + 1). This is the vector used in Section 2.3 to remove nodes from a rule. If this vector is such that c k ≥ −w (N) k , then w (N+1) k ≥ 0, which is the primary goal. In this section, these properties are translated to conditions on x N+1 that describe in which cases a node can be added to a quadrature rule. The interpolatory quadrature rule X N , W N has degree N, so after adding x N+1 the following should hold to ensure that the new rule is interpolatory: From this, it follows for j = 0, . . . , N that (using w (N) The goal is to construct X N+1 and W N+1 such that they form a quadrature rule of degree N + 1.
which can be expressed in terms of the vector c as The value of ε N+1 can be interpreted as the approximation error of the quadrature rule with nodes X N and weights W N with respect to µ N+1 . Combining (3.1) and (3.2) yields the following system of linear equations for the vector c: or more compactly: with ε = (0, . . . , 0, ε N+1 ) T . The vector ε has a large number of zeros so it is convenient to apply Cramer's rule to this linear system, which yields where V k (X N+1 ) is equal to V (X N+1 ) with the kth column replaced by ε, where the indexing of columns is started with 0.
This expression can be simplified by noticing that Vandermonde matrix constructed with the nodal set X N+1 \ {x k }. By using (2.3), the following is obtained for k = 0, . . . , N + 1: The denominator of this expression can be written as ℓ ′ N (x k ), where ℓ N (x) = ∏ N j=0 (x − x j ) is the nodal polynomial. To keep the dependence on x N+1 clear, this notation is used sparingly in this article.
The goal is to have positive weights, i.e. w (N+1) k = w (N) k + c k ≥ 0, which can be used to prove the following theorem.
Proof. If X N+1 forms the nodal set of a positive interpolatory quadrature rule, then Subtracting w (N) k from both sides of the inequality yields (3.5). Vice versa, if (3.5) holds, it follows that , then the theorem yields that the new rule has positive weights if and only if the current rule has positive weights. This is not surprising: any node x N+1 can be added to such a rule with w (N+1) N+1 = 0 (and with w (N+1) From a computational point of view (3.5) might not be a numerically stable way of computing the bounds that describe all nodes that can be added. In the context of quadrature rules, numerical instabilities are usually alleviated by changing the basis of the Vandermonde matrix, but this is not applicable in this case since the determinant is up to a scaling factor independent from the basis used to construct the Vandermonde matrix (and this factor cancels out in (3.3)). Nonetheless, (3.5) can be evaluated in a numerical stable way using the well-known barycentric formulation of the interpolating polynomial. The interested reader is referred to [28].

Quadrature rule adjustments
Theorem 2 describes a necessary and sufficient condition for a quadrature rule to have positive weights if both x N+1 and ε N+1 are known. A main novelty of this work is to employ a geometrical interpretation of (3.5), from which several possible adjustments of quadrature rules can be derived. The most straightforward one is that all nodes x N+1 can be determined that yield a positive interpolatory quadrature rule upon adding one of them to an existing quadrature rule. Moreover the formula also yields procedures to replace nodes in a quadrature rule, keeping the weights positive. The latter adjustment will be useful in Section 4, where it can be used to determine all possible M nodes that can be added to a rule.
In Section 3.2.1 we further consider (3.5) and discuss the geometrical relation between the new node x N+1 and the quadrature error ε N+1 . In Sections 3.2.2 and 3.2.3 we discuss the addition and replacement of nodes in a positive interpolatory quadrature rule such that positivity of the weights is preserved. These operations follow directly from the geometrical interpretation of Theorem 2 derived in Section 3.2.1. The removal of a node, as outlined in Section 2.3, can also be formulated as a consequence of Theorem 2, which is not done here since the removal of nodes has been considered extensively in previous work [19,22,23,26].

Geometry of nodal addition
The inequalities from (3.5) are N +2 linear inequalities in x N+1 and ε N+1 . This can be seen by rewriting (3.4) as follows: If two values of x N+1 , c k (for k = 0, . . . , N + 1), or ε N+1 are known, all other values can be determined from these expressions, which enforces that the obtained quadrature rule is again interpolatory. To incorporate positive weights, we use that for k = 0, . . . , N it holds that By combining this with (3.5) and requiring w (N) k + c k ≥ 0 inequalities of the following form are obtained: These are linear inequalities describing the relation between x N+1 and ε N+1 such that w (N+1) Even though the rightmost inequalities are non-linear, their sign solely depends on the location of x N+1 with respect to the other nodes. Hence the exact value of the product is not of importance. Example 1. The inequalities from (3.8) are visualized as functions from x N+1 to ε N+1 in Fig. 1 for the quadrature rule with X N and W N as follows: The left subfigures demonstrate some key properties of the derived inequalities. The inequalities are linear and switch sign at the node, which is the rightmost condition of (3.7). The characteristics of the last inequality ( Fig. 1(d)) solely depend on the location of x N+1 with respect to the other nodes. A combination of all inequalities ( Fig. 1(e)) has varying characteristics between different nodes, but it is always a system of linear inequalities. The line ε N+1 = 0 is contained in all shaded regions, because any node with weight equal to zero can be added to the rule if the next moment µ N+1 is already correctly integrated by the quadrature rule.
The relation between x N+1 and ε N+1 from (3.8) can be interpreted in two ways. Firstly, if a new node x N+1 is given, an upper bound and a lower bound on ε N+1 can be determined such that upon adding x N+1 to the quadrature rule, a positive interpolatory quadrature rule is obtained. Geometrically these are the bounds of the shaded area with the x = x N+1 line. This interval is never empty (as ε N+1 = 0 is always in the shaded region). Secondly, if ε N+1 is given, a (possibly empty) set can be determined such that a positive interpolatory quadrature rule is obtained upon adding a node from such a set.
Geometrically this is equivalent to determining the bounds of the shaded area with the y = ε N+1 line.
The second interpretation can be used to add nodes to a quadrature rule, i.e. ε N+1 is known and the goal is to determine x N+1 (this is discussed in Section 3.2.2). The first interpretation can be used to replace nodes within a quadrature rule: x N+1 is added to the nodal set and an existing node can be removed by setting its weight to zero (this is discussed in Section 3.2.3).

Addition of a node
A direct consequence of (3.7) is that all nodes that can be added to a quadrature rule can be defined by means of intervals, obtained via a linear inequality. The results are discussed in the following lemmas. The first focuses on keeping the existing weights of the quadrature rule positive, the second focuses on ensuring that the additional weight (i.e. of the added node) is positive. N+1 be as follows: ) .

Or in other words, if and only if x N+1 is not between x k and x
[k]

N+1 .
Proof. Adding a node is determining an x N+1 that solves (3.7) if ε N+1 is known. Hence, to keep the kth weight positive, this is equivalent to computing the solution x [k] N+1 of the following problem: Here we used ℓ ′ N to make the notation more compact. Hence if w (N) N+1 is such that, if added to the quadrature rule, an interpolatory quadrature rule is obtained with w (N+1) k = 0 (the other weights may be negative). Assume N+1 , without loss of generality. Then any node The proof of this lemma can also be stated geometrically, using one of Figs. 1(a), 1(b), or 1(c). If ε N+1 is known, those x N+1 that are such that (x N+1 , ε N+1 ) is not part of a gray region form the interval as stated in the lemma. Here, N+1 is the intersection of the line passing through x k and the constant line ε N+1 . All intervals I k are bounded, so there always exists a node x N+1 ∈ (I 0 ∩ · · · ∩ I N ), or in other words, there always exists a node that keeps the existing N + 1 weights of a quadrature rule positive upon addition.
Obviously, the goal is also to ensure that the weight of the added node is positive, which can be described by means of a series of intervals. The details of this are discussed in the following lemma. Lemma 4. Let X N , W N form the nodes and the weights of a positive interpolatory quadrature rule, let ε N+1 from (3.2) be given. Without loss of generality, assume that x 0 < x 1 < · · · < x N . Then w (N+1) N+1 ≥ 0 upon addition of x N+1 to the quadrature rule if and only if one of the following holds for all k = 0, . . . , N: Addition of a new node to and replacement of an existing node within the quadrature rule X N = {−1, −1/6, 1} and ρ ≡ 1/2. Left: all nodes that can be added to a quadrature rule form intervals, in this case the interval [0, 7/9] and the interval (−∞, −5/3] (of which the latter is not depicted). Right: the closed sets Ω k depict all possible replacements within a quadrature rule. If the goal is to construct a positive interpolatory quadrature rule, the node x k can only be replaced by nodes from the set Ω k .
Proof. Recall the derivation of (3.8), i.e. the relation between x N+1 , w (N+1) N+1 , and ε N+1 : The first term flips sign only at x N+1 = x k (for any k = 0, . . . , N), hence if, for given k, Combining this with the sign of ε N+1 results in the statement of the lemma. □ Geometrically, Lemma 4 describes the intervals of Fig. 1(d). Notice that Lemma 4 can also straightforwardly be applied to cases where w (N) if the quadrature rule has weights equal to zero. Using Lemmas 3 and 4 the set I can be computed such that any x N+1 ∈ I can be added to a quadrature rule X N and W N such that positive weights are obtained (and adding any x N+1 / ∈ I yields a rule with at least one negative weight). The procedure is to firstly compute all intervals I 0 , . . . , I N from Lemma 3 and construct I = I 0 ∪ · · · ∪ I N . Secondly, Lemma 4 is used to remove intervals of the form [x k−1 , x k ] from I.
The exact details of this procedure are outlined in Algorithm 1. No advanced interval arithmetic is necessary to implement this algorithm, only a procedure that implements the removal of an interval from a series of intervals is needed.

Example 2.
Reconsider the quadrature rule from Example 1. Then the bounds of the intervals containing nodes that can be added, i.e. the solutions of (3.9), are depicted in Fig. 2(a) as open circles. Here, µ N+1 = 0, so from a straightforward computation it follows that ε N+1 = −1/9. A constant ρ is considered here. In this case, the values of x [k] N+1 are (from left to right) −5/3, 0, and 7/9, of which the first is not visible in the figure. Adding any of these nodes yields a quadrature rule with positive weights, but we emphasize that this is generally not the case for other quadrature rules. Hence adding any node from the set I = (−∞, −5/3] ∪ [0, 7/9] yields a positive interpolatory quadrature rule. Restricting x N+1 to the set Ω further reduces the number of possible intervals.

Algorithm 1 Addition of a node
Input: Positive, interpolatory quadrature rule X N , W N , raw moment µ N+1 (or, equivalently, ε N+1 ) Output: Set I ⊂ R such that X N ∪ {x} forms the nodal set of a positive, interpolatory quadrature rule if and only if x ∈ I N+1 > x k then 9: 10: else 11: end if 13: end if 14: 15: if k > 0 and w k > 0 then 16: else 18: end if 20: else 21: if k < N and w k > 0 then 22: else 24: end if 26: end if 27: end for 28: Return I Notice that I = ∅ if ε N+1 ̸ = 0 and w (N) k = 0. This can be derived mathematically, but it also follows from the mere fact that all weights change (see (3.9)) upon addition of a node to a quadrature rule, so w (N+1) k = w (N) k = 0 is not possible. If ε N+1 = 0, no node can be added to enforce that w (N) k = 0. However, any node with weight equal to zero can be added, hence the formula yields x Technically, the quadrature rule now has a node equal to x k with weight equal to zero. Nonetheless, this results in a singular Vandermonde matrix (which contradicts the theory developed so far), so we do not further study this specific case.
If Ω = R and the number of nodes is odd, it is always possible to add a single node to a quadrature rule: in this case the result from Lemma 4 either states that , but never both. Geometrically this means that the leftmost and rightmost shaded regions grow to infinity and minus infinity respectively (or vice versa). Similarly, if Ω = R and the number of nodes is even, it is always possible to add a single node if ε N+1 ≥ 0.
However, in any other case (i.e. that of a bounded Ω or even number of nodes with ε N+1 < 0) adding a single node to a quadrature rule is not always possible, as shown in the following example.
Example 3. Adding a single node to the following interpolatory quadrature rule is not possible when requiring positive weights: } .
Note that this example can be obtained straightforwardly by adding the node 1/11 to the quadrature rule from Example 1 and redetermining the weights likewise.

Replacement of a node
Replacing a node is equivalent to adding a node, with the difference that the goal is to determine this node such that the weight of an existing node in the obtained quadrature rule becomes zero, i.e. w (N+1) k = 0 for a k ≤ N. This is equivalent to determining a specific (x N+1 , ε N+1 ) pair that yields w (N+1) k = 0, which was used to determine all possible additions in Section 3.2.2. The main difference with addition is that the next moment µ N+1 is not used, as the number of nodes and the degree of the rule do not change. This makes ε N+1 a free variable.
The relation between ε N+1 and x N+1 is already derived, so by reconsidering (3.9) with the goal to determine both x N+1 and all ε [k] N+1 (indexed by [k] with k = 0, . . . , N) that make w (N+1) k = 0 the following expressions are obtained: (3.10) We will interpret this expression as a function of positive and interpolatory. The details are discussed in the following lemma.

Proof. Let ε [k]
N+1 be defined by (3.10). Consider ε − and ε + , defined as follows: Hence ε − < 0 < ε + . Using Lemma 3, it follows that using either ε − or ε + to add x N+1 results in a quadrature rule with w (N+1) k ≥ 0 for k = 0, . . . , N. Moreover, by definition of ε − and ε + these rules have one (or more) weight equal to 0. From Lemma 4 it follows that either the rule constructed using ε − or the rule constructed using ε + has w (N+1) N+1 ≥ 0 (and the other has w (N+1) N+1 ≤ 0). Concluding, either ε − or ε + can be used to construct a positive interpolatory quadrature rule with at least one weight equal to zero. Nodes with weights equal to zero can be removed without affecting the quadrature rules. This is equivalent to having added a node x N+1 and having removed one, say x k , which is the statement of the lemma. □ The proof of the lemma is constructive, and therefore describes a straightforward method to replace nodes in a quadrature rule. Given x N+1 ∈ Ω, the procedure is to compute ε + and ε − , figure out whether ε N+1 = ε + or ε N+1 = ε − yields w (N+1) N+1 ≥ 0 by using Lemma 4, and finally compute the quadrature rule after replacement. These steps are outlined in detail in Algorithm 2. Geometrically, the approach computes the two lines closest to the ε N+1 = 0 line, i.e. the boundary of the gray region, and determines which of these lines correspond to obtaining a quadrature rule with only positive weights (see Fig. 2(b)).
Consequently, the domain of a quadrature rule, depicted by Ω ⊂ R, can be decomposed in subsets Ω 0 , . . . , Ω N that indicate which node can be replaced. If x N+1 ∈ Ω k , (X N ∪ {x N+1 }) \ {x k } forms the nodal set of a positive interpolatory quadrature rule. Combining the results of Lemmas 4 and 5, these sets can be denoted in the following way: The sets Ω k have been depicted in Fig. 2(b). Notice that the boundaries of these sets correspond to positions where two lines intersect, or in other words, those x N+1 ∈ Ω k that result in two weights equal to zero, if used for replacement. One of these weights is, by construction, w (N+1) k . If the other weight is w (N+1) l , we also have x N+1 ∈ Ω l . This geometrical observation can be made explicit, which can be used to actually compute Ω k : these N+1 (x N+1 ), or equivalently: Hence we have proved the following lemma.

Algorithm 2 Replacement of a new node
Input: Positive, interpolatory quadrature rule X N , W N , new node x ̸ ∈ X N Output: Positive, interpolatory quadrature ruleX N ,Ŵ N , with x ∈X N and #(X N ∩ X N ) = N 14: end if 15: end for 16: 19: Let k be given and let ∂Ω k denote the boundary of Ω k . Then, for any x N+1 ∈ ∂Ω k , we have that for an l ∈ 0, . . . , N.
The result is a procedure to compute the boundaries of a specific Ω k . Firstly, for l = 0, . . . , N, compute x (k,l) such that (3.11) Those x (k,l) that yield a positive interpolatory quadrature rule upon replacement (e.g. computed using Algorithm 2), form the boundary of the interval Ω k . If x l < x (k,l) , it follows that [x l , x (k,l) ) / ∈ Ω k , since a replacement with x N+1 ∈ [x l , x (k,l) ] results in a negative w (N+1) l (similar for x l > x (k,l) ). The procedure to determine Ω k explicitly is outlined in Algorithm 3. Here, the indexing is slightly changed to be able to reuse parts of Algorithm 1, since we still need to ensure that the weight of the added node (which replaces x k ) is positive.

Algorithm 3 Replacement of a given node
Input: Positive, interpolatory quadrature rule X N , W N , node x l ∈ X N Output: Space Ω l , such that (X N ∪ {x}) \ {x l } forms the nodal set of a positive, interpolatory quadrature rule if and only if x ∈ Ω l 1: if x k < x (k,l) then 7: : The values of x N+1 that solve (3.11) form a special case. Since x N+1 ∈ Ω k ∩Ω l , the quadrature rule (X N ∪{x N+1 })\{x k , x l } is positive, interpolatory, and has degree N, even though it consists only of N nodes. The latter result is remarkable: two nodes are removed and one is added, but the degree of the quadrature rule is not affected. Such rules have a non-trivial high degree and are therefore more accurate than interpolatory quadrature rules without this property.

Example 4.
An example of an interpolatory quadrature rule with non-trivial high degree is X N = {−1, 1/3}, obtained by adding 1/3 to the quadrature rule of Example 1 (and removing all nodes with zero weight). All nodes that can be added to obtain such a rule are the intersection of two lines in Fig. 2(b). More generally, all nodes x k that can be added to a rule can be found by determining the bounds of the shaded region and observing which node belongs to the obtained bound. Consequently, the fact that Ω = ⋃ N k=0 Ω k follows visually from Fig. 2
The node x (k,l) only depends on the nodes x j with j ̸ = k and j ̸ = l, i.e. its value is independent from x k and x l . This is not evident, as (3.11) depends on these nodes. However, it can be demonstrated by using that the rule is interpolatory, which yields: Here, L k (x) is the kth Lagrange basis polynomial. Replacing this expression in (3.11) and using that ℓ ′ yield an equality that can be simplified to the following: This expression is in fact a Patterson extension (consider (2.6) with j = 0). The tight relation between the Patterson extension and the framework discussed in this article is further discussed in Section 3.3.1.

Constructing quadrature rules
In the previous section the theoretical foundation for extending a positive interpolatory quadrature rule with a single node is derived. In this section, firstly it is discussed how addition relates naturally to the Patterson extension [8,29] of (non-Gaussian) quadrature rules. Secondly, due to the simplicity of addition and replacement of a node, quadrature rules based on these procedures can be derived numerically fast and accurately, and an example is discussed.
As discussed previously, there does not always exist a single node that can be added such that positive weights are obtained, so it is non-trivial to construct a sequence of positive interpolatory quadrature rules by consecutively adding a single node to the rule. There are various possibilities to alleviate this, e.g. by allowing negative weights, relaxing the strict requirement that all nodes of the quadrature rule have to be preserved, or by adding multiple nodes instead of one. In this article, the second and third options are further considered. For this purpose, a quadrature rule is presented based on the replacement of nodes. The rule has positive weights and is interpolatory, but is strictly speaking not fully nested. The details are considered in Section 3.3.2. The addition of multiple nodes is further discussed in Section 4.

Patterson extension
Remarkably, both the addition and replacement of a node can yield a Patterson extension of a quadrature rule. In both cases, the focus is on the nodes that yield a zero weight upon addition to the quadrature rule.
In Section 3.2.2 it was noticed that any weight from a quadrature rule can be made equal to zero by exploiting the relation between ε N+1 and x N+1 . In Example 2 the quadrature rule X N = {−1, −1/6, 1} was considered, where the nodes −5/3, 0, and 7/9 are such that upon adding one of these to the rule, a rule of only three nodes with non-zero weights of degree three is obtained. Notice that these nodes are Patterson extensions of quadrature rules (as discussed in Section 2.2), as they can be interpreted as adding one node (M = 1) to a quadrature rule of two nodes (N = 1), obtaining a rule of degree three (N + 2M = 3). This also holds in general: for given k, adding one node x [k] N+1 from (3.9) (so M = 1) to the interpolatory quadrature rule X N \ {x k } (with degree N − 1) yields a quadrature rule with N + 1 nodes and degree N + 1 (which equals (N − 1) + 2M).
In Section 3.2.3 the notation x (k,l) was introduced to denote nodes that, upon adding them to the rule, yield a (possibly negative) interpolatory quadrature rule with w (N+1) k = w (N+1) l = 0. These nodes also form a Patterson extension. To see this, notice that the replacement is adding a single node to the quadrature rule X N−2 = X N \ {x k , x l }. The Patterson extension of a single node of this quadrature rule is a quadrature rule consisting of N nodes of degree (N − 2) + 2M = N (adding one node means M = 1). By construction, this rule has the nodes X N−2 ∪ {x (k,l) }. Notice that x (k,l) is not a Patterson extension of the quadrature rule that has been used to determine it, i.e. X N , W N in (3.11). However, its definition allows for a straightforward way to determine this extension. First, add (randomly) two nodes to the quadrature rule X N , W N , obtaining a possibly negative interpolatory quadrature rule X N+2 , W N+2 . Then the node x (N+1,N+2) is the Patterson extension of the quadrature rule with nodes X N , because upon adding this node to X N+2 , the weights of the randomly added nodes become zero. As the Patterson extension is unique, this construction is welldefined. Naturally, this is not the preferred approach to construct a Patterson extension, but it embeds such extensions into the framework discussed here.
The Patterson extension is also obtained as a special case if multiple nodes are added to a quadrature rule. This will be discussed in Section 4.3.

Partially nested, positive, and interpolatory quadrature rule
The addition and replacement of a single node are straightforward procedures described as the solutions of linear inequalities. However, there does not always exist a single node that can be added such that all weights remain positive.
In this section, this is alleviated by relaxing the requirement that X N ⊂ X N+M .
To this end, let X N andX N+1 be the nodes of two positive interpolatory quadrature rules, possibly with X N ̸ ⊂X N+1 .
The nodesX N+1 can for example form a Gaussian quadrature rule. The idea is to iteratively replace nodes inX N+1 with nodes from X N , i.e. removing x k ∈X N+1 and adding x k ∈ X N . Ideally, all nodes x k ∈ X N can be added to x k ∈X N+1 , which would yield a rule that reuses all nodes in X N .
In other words, if X N = {x 0 , . . . , x N } andX N+1 = {x 0 , . . . ,x N+1 }, for each node x k ∈ X N \X N+1 the set Ω j is identified (see Section 3.2.3) such that (X N+1 ∪ {x k }) \ {x j } is the nodal set of a positive and interpolatory quadrature rule. If there is an x k such thatx j ̸ ∈ X N , we setX N+1 ← (X N+1 ∪ {x k }) \ {x j } and keep repeating this procedure until no such x k exists anymore. If there are multiple x k that could possibly be used to trigger a replacement inX N+1 , the smallest one is selected in the example presented in this article.
The nodes from X N that cannot be added toX N+1 are reconsidered in consecutive iterations and added again if possible. It is difficult to theoretically quantify the number of nodes from X N that can be ''added'' this way toX N+1 , though it is straightforward to see that there exists at least a single x k ∈ X N that can be reused.
To demonstrate this procedure numerically, let X 1 and W 1 form a Gaussian quadrature rule of two nodes. If the uniform distribution is considered, evaluating all quadrature rules up to N = 19 requires in total 22 unique evaluations of u, which is two more than optimally possible considering the limitations of the framework as discussed in this work. The obtained sequence is depicted in Fig. 3(a) (the two additional evaluations of u can be found at N = 15 and N = 18). This result seems to be somewhat independent from the distribution, since applying the same approach to construct a sequence of quadrature rules with respect to a Beta(10, 10) distribution requires in total 23 function evaluations, which is three more than optimally possible (the obtained rules are depicted in Fig. 3(b)).
The main advantage of this approach compared to the previously discussed Patterson extension is that it always has positive weights. Moreover the expressions to compute the nodes contained in the quadrature rule are straightforward. However, the approach has the same disadvantage as the removal of nodes (see Section 2.3), since it requires a sequence of existing quadrature rules.

Addition of multiple nodes
In the previous section a counterexample of a positive interpolatory quadrature rule is discussed that cannot be extended by adding a single node. In this section we will therefore study the addition of multiple nodes to a quadrature rule. The problem setting is that of Section 2.4: given a positive interpolatory quadrature rule X N , W N , determine M as small as possible and nodes X N+M with X N ⊂ X N+M such that X N+M forms the nodal set of a positive interpolatory quadrature rule.
The first step is to extend the derivation of Section 3.1 for the addition of multiple nodes. The derivation is again based on Cramer's rule. With the theory that is derived in upcoming Section 4.1 it is not obvious how nodes can be added to the quadrature rule, but it provides geometrical insight in the location of such nodes with respect to the existing nodes. Again we can derive some non-trivial adjustments one can apply to a quadrature rule. These are discussed in Section 4.2. Similar to the case of a single node, there is a tight relation with the Patterson extension. In this case, the Patterson extension for general M is recovered. This is discussed in Section 4.3, including some examples of nested quadrature rules obtained with the theory derived in this section.

Positive weight criterion
The idea is similar to the derivation of the addition of single node. Let X N be the initial nodal set and let M be given.
The goal is to determine X N+M with X N ⊂ X N+M such that it forms the nodal set of a positive interpolatory quadrature With a similar reasoning as before it is straightforward to observe that the following should hold for such a vector to ensure that the obtained quadrature rule is interpolatory: k . This can be written in the form of a linear system as follows: Applying Cramer's rule to this system requires more bookkeeping, as the right hand side contains multiple non-zero entries. Let ε = (0, . . . , 0, ε N+1 , . . . , ε N+M ) T , then Cramer's rule prescribes where V k (X N+M ) is equal to V (X N+M ) with the kth column (indexed from 0) replaced by ε. The numerator can be further expanded as follows: where V (j,k) (X N+M ) is the (j, k)-minor of V (X N+M ) (i.e. the matrix without its jth row and kth column, where both indices start at 0). Hence for c k the following expression is obtained: The same derivation is commonly used to derive the determinant of a Vandermonde matrix [30,31], and it is well-known that the ratio of determinants obtained in this expression is an elementary symmetric polynomial. The kth elementary symmetric polynomial is generally defined as the sum of all monomial permutations of length k, that is as follows: The elementary symmetric polynomials are only defined for k ≤ N + 1 and by convention e 0 ≡ 1. Concluding, the following expression is obtained for c k : Here, e k is the kth elementary symmetric polynomial as defined above. With a little abuse of notation, we used: We are now in a position to formulate a theorem in similar form as Theorem 2, but then for multiple nodes. The proof is omitted, since it is equivalent to that of Theorem 2, but then with the equalities derived in this section.

Quadrature rule adjustments
Theorem 7 presents a necessary and sufficient condition for a quadrature rule extended with M nodes to have positive weights. Contrary to the addition of a single node, it cannot be used directly to determine possible nodes that can be added to the quadrature rule. This can be seen by rewriting it in a similar form as (3.7), i.e. for k = 0, . . . , N + M: Notice that, if x N+1 , . . . , x N+M are unknowns, an M-variate system of N + M + 1 polynomial inequalities is obtained. In general these systems are very difficult to solve, so we do not directly pursue a solution of the system above. Nonetheless, the system still provides a geometrical interpretation about where solutions reside, similar to the case of single node addition (though less intuitive). This is discussed in Section 4.2.1. Based on these geometrical insights, procedures to replace nodes and to add nodes, which extend those explained previously, can be derived. These procedures are discussed in Sections 4.2.2 and 4.2.3 respectively.

Geometry of nodal addition
The type of the inequalities (4.1) (i.e. ''greater than'' versus ''less than'') does not change between two nodes and if this type is fixed, the system consists of polynomial inequalities. Hence the region where M nodes can be added is described by a continuous boundary, bounded by the polynomial inequalities of (4.1), consisting of lines, surfaces, or ''hypersurfaces'' through the nodes.
If one of the right hand sides of (4.1) changes sign, there is an addition of M nodes such that the inequality forms an equality for a specific k. In such cases, there is an addition such that one of the nodes obtains a weight equal to zero. This is equivalent to the case discussed in Section 3.2.3, where a single node is added in order to set the weights of another node equal to zero.
It is difficult to visualize the addition of M nodes in a similar way as we visualized the addition of one node, as there are M nodes x N+1 , . . . , x N+M and M quadrature rule errors ε N+1 , . . . , ε N+M . Plotting the errors with respect to the nodes (as in Fig. 2) is therefore not viable, as this is a plot from R M to R M .
On the other hand, if the distribution ρ(x) is fixed beforehand, the values of ε N+1 , . . . , ε N+M are known and contour plots of the regions encompassing all M nodes that can be added can be made (provided that M is small enough). The dashed lines indicate where the inequalities (4.1) with k = N + 1 and k = N + 2 change sign. If this happens, one of the new nodes x N+1 or x N+2 has weight equal to zero. This line forms everywhere a boundary of the shaded area: the node with weight equal to zero can be replaced by any other node, while still resulting in an interpolatory quadrature rule with positive weights. This situation is equivalent to adding a single node x N+1 to the quadrature rule, but gaining two degrees, as discussed in Section 3.2.2.
The addition and replacement of multiple nodes follow readily from this example. Notice that if any coordinate (x N+1 , . . . , x N+M ) is known, the replacement for M = 1 can be used to reach any other coordinate (x N+1 , . . . , x N+M ) in the same region (shaded in Fig. 4). Hence if all corners of those regions are determined (depicted as open circles in Fig. 4), the full region can be explored straightforwardly using Algorithm 3. As these corner cases form a replacement of nodes, we start by discussing replacement of M nodes. Moreover, it will be shown that these corners are a Patterson extension. Based on the algorithm to determine all these corners, addition of M nodes follows straightforwardly.

Replacement of multiple nodes
Let X N , W N be an interpolatory quadrature rule and let indices k 1 , . . . , k M be given such that 0 ≤ k i ≤ N and k i ̸ = k j for i ̸ = j. In this section the goal is to determine the interpolatory quadrature rule X N+M , W N+M such that w (N+M) k i = 0 for all k i . Notice that this is equivalent to replacing the nodes x k 1 , . . . , x k M in the quadrature rule X N by the nodes x N+1 , . . . , x N+M .
The nodes with this property are the intersections of the polynomials of (4.1) and they are depicted as open circles in Fig. 4. Moreover, they describe the boundary of the set of nodes that can be added to the quadrature rule. The desired nodes x N+1 , . . . , x N+M can be determined by calculating the Patterson extension of the interpolatory quadrature rule with the nodes X N \ {x k 1 , . . . , x k M }, for which efficient techniques exist [5,11,29]. Such techniques require that M must be known a priori and they do not provide a simple geometrical interpretation. Therefore we proceed by embedding the Patterson extension in the framework discussed here. This yields an alternative, new algorithm to determine these nodes, which is mainly of theoretical and geometrical interest, since it requires the computation of large numbers of roots of polynomials.
We start by solving a slightly easier problem. Assume ε N+1 = · · · = ε N+M−1 = 0 and ε N+M ̸ = 0. Notice that, if ε N+M is neglected, any addition of M − 1 nodes yields a valid quadrature rule (as these nodes have zero weight). Geometrically, a fully shaded figure (if drawn as Fig. 4) is obtained. This can be exploited to determine the desired nodes, as only the value of ε N+M imposes a condition on the nodes x N+1 , . . . , x N+M .
The nodes that yield w (N+M) = 0 can be found by applying Theorem 7 with c k i = −w (N) k i for all i or by consecutively applying Theorem 2. In both cases, the following is obtained: In principle this system of polynomial equalities is difficult to solve, but it has a certain structure that can be exploited.
To see this, letl M (x) be the nodal polynomial of the nodes x N+1 , . . . , x N+M : which translates the system above to If the nodal polynomiall M is known, its roots equal x N+1 , . . . , x N+M . The nodal polynomial has degree M and it is known that its leading order coefficient equals 1. Therefore it is useful to introduce the polynomial q M (x) :=l M (x) − x M , which has degree M − 1. Then (4.3) can be rewritten as follows: Even though assuming ε N+1 = · · · = ε N+M−1 = 0 is not realistic in practical cases, this procedure can readily be extended to the general case. For this we reuse the replacement step from Section 3.2.3. If ε N+1 ̸ = 0, then a single node is added to the quadrature rule such that w (N+1) k 1 = 0. This is equivalent to applying Algorithm 2 with x N+1 = x (k,l) , as discussed in Section 3.2.3. Then the obtained quadrature rule X N+1 \ {x k 1 } has ε N+1 = 0. By applying the procedure discussed above to these N + 1 nodes, the nodes x N+2 and x N+3 can be determined such that w (N+2) i.e. we enforce that the weight of x k 2 is zero and the weight of the previously added node becomes zero. The obtained rule has N + 3 nodes, where two nodes have weight equal to zero. This is again a replacement, but here two nodes get weight equal to zero, which is a generalization of the replacement discussed in Section 3. As stated before, any algorithm that computes Patterson extensions can be used to verify whether M nodes exist that can be added to the rule. If a Patterson extension with non-negative weights is found, say x N+1 , . . . , x N+M , Algorithm 3 can be used to explore all possible additions to the quadrature rule.
The algorithm based on the geometrical interpretation used in this article is outlined in Algorithm 4. By iterating over all possible sorted sequences (k 1 , . . . , k M ), this procedure can be used straightforwardly to verify whether there exist M nodes that can be added to a given quadrature rule (though this is a costly procedure).
There are two special cases that are (for sake of simplicity) not incorporated in exists, then all these weights are zero, which is the primary goal of the algorithm. Secondly, if r k ∈ X N or ε N+m = 0, a quadrature rule is obtained that has higher degree than its number of nodes. This can be incorporated by combining all double nodes in X N and likewise adding the respective weights and by skipping any iteration that has ε N+m = 0. select if the goal is to add one or two nodes to the quadrature rule. Hence selecting any node between the two squares and adding it yields a quadrature rule to which again a node can be added. The interval of adding a single node is the same as depicted in Fig. 2(a). Right: The quadrature rule obtained by adding the rightmost highlighted node of the left figure (i.e. ''the rightmost square''). Hence there is only a single node (denoted by the open circle) that can be added to the rule.

Addition of multiple nodes
By combining the quadrature rule replacement of Section 3.2.3 (for M = 1) and the replacement of the previous section (for M > 1), we obtained a naive algorithm to firstly determine M as small as possible such that there exists a positive interpolatory quadrature rule X N+M (Algorithm 4) and secondly to explore all such M nodes (Algorithm 3, yielding the shaded areas of Fig. 4).
Determining the number of nodes M that can be added to an interpolatory quadrature rule can straightforwardly be done by solving (4.2) for each sequence of k 1 , . . . , k M with k 1 < · · · < k M . This gives all locations where M nodes have zero weight. If at any of these locations all nodes have non-negative weight, then M nodes can be added to the rule. Otherwise, M is increased and the process is repeated.
Often the value of M is unknown a priori. Besides determining the M nodes that can be added, the goal is also to determine M as small as possible (this is also how we formulated the problem originally in Section 2.4). Algorithm 4 can be used to determine M, as results from previous iterations can be reused. To see this, suppose a quadrature rule is given and by applying Algorithm 4 it is known that no addition of at most M − 1 nodes exist. Then during these calculations, all sequences of nodes have been determined that make M −1 weights zero. By initializing Algorithm 4 with these sequences, only the last iteration of the loop is necessary, which significantly reduces the computational expense.
It is required to repeatedly determine large numbers of polynomial roots in this algorithm. This is nearly impossible to do symbolically, except for some special cases (e.g. M ≤ 3 or symmetric quadrature rules). Moreover determining the roots numerically can result in quick aggregation of numerical errors. We use variable precision arithmetic, i.e. determine the roots with a large number of significant digits. For large N this is a costly algorithm, as the number of sorted sequences of length M equals #(k 1 , . . . , k M ) = which grows fast for large N. Therefore using this algorithm to compute all removals is slower than using existing techniques to compute the Patterson extension, albeit that it is able to reuse all additions of M − 1 nodes to compute all additions of M nodes. If all sets of M nodes have been determined that can be added to the quadrature rule, the techniques from Section 3.2.3 can be used to fully explore all nodes that can be added to the rule. This requires solving linear equalities, which can be done fast and accurately.
The possibility of adding M nodes to the quadrature rule does not guarantee the possibility of adding M + 1 nodes to the quadrature rule, which is shown in the following example. } .
In Fig. 5(a) regions are depicted where a single node can be added (similar to Fig. 2(a)) and regions where, upon adding a node from that region, another node can be added (this is the projection of Fig. 4(a)). The addition of the rightmost node with the latter property is depicted in Fig. 5(b), demonstrating that there is a single node that can be added and that this is indeed a limiting case.
Notice that the intervals where a single node and where two nodes can be added are independent from each other.
There exist pairs of nodes x N+1 , x N+2 firstly such that both W N+1 and W N+2 are all positive (in the right interval surrounded by squares), secondly such that W N+1 is positive, but W N+2 is not (the right interval surrounded by circles, outside the interval surrounded by squares), thirdly such that W N+1 is not positive, but W N+2 is (the left interval surrounded by squares), and finally such that both W N+1 and W N+2 are always negative (outside all intervals).

Constructing quadrature rules
Similar to the case of addition of a single node, the Patterson extension is obtained for specific choices of nodes that are added to the rule. In fact, the nodes determined with Algorithm 4 are a Patterson extension of a quadrature rule with a smaller number of nodes. As the Gaussian quadrature rule is a special case of the Patterson extension, this rule also follows from the framework discussed in this article. This is discussed in more detail in Section 4.3.1.
By repeatedly applying Algorithm 4, a sequence of nested quadrature rules can be determined. These rules and their properties are considered in Section 4.3.2.

Patterson extension
The For general M, the Patterson extension can be deduced mathematically as follows. Let X N , W N be a quadrature rule and, as before, let x N+1 , . . . , x N+M be such that the following nodes form a quadrature rule of degree N + M: Furthermore, let X N−M be the nodes of an interpolatory quadrature rule of degree N − M be as follows: Upon adding {x N+1 , . . . , x N+M } to X N−M , the nodes from (4.5) are obtained, that have degree N + M. Hence M nodes are added to an interpolatory rule of degree N − M and the obtained degree is N + M, which is by definition a Patterson extension. Notice that the obtained quadrature rule is interpolatory, but not necessarily positive.
The Gaussian quadrature rule can be deduced as a special case from Algorithm 4. To see this, suppose M = N + 1, which is the number of nodes of the rule under consideration. In that case, there is only a single sequence of k 1 , . . . , k M , defined as follows up to a permutation: k j = j − 1 for j = 1, . . . , N + 1.
By applying Algorithm 4, the nodes from (4.5) are obtained with M = N + 1, which are: Hence the N + 1 nodes x N+1 , . . . , x 2N+1 form a quadrature rule of degree 2N + 1, which is by definition the Gaussian quadrature rule. In other words, when adding a Gaussian quadrature rule to an existing quadrature rule and setting all existing weights to zero, a valid addition is obtained. 1. In the first iteration, it follows thatl 1 (x) = x + 5/3 and therefore the following quadrature rule is obtained: } .
In this specific example it is possible to determine all nodes symbolically, but for larger values of M this is generally not possible.
Considering the nodes in a different order results in different intermediate Patterson extensions, but obviously the Gaussian quadrature rule is the rule that is finally obtained. These steps also demonstrate the possibility to store intermediate results: only the nodes of step 2 are necessary to deduce the nodes of step 3.
Specialized algorithms exist for specific distributions and specific values of N and M to construct Gaussian, Gauss-Kronrod, and Gauss-Patterson quadrature rules [4,5], but it remains a challenging topic to determine the Patterson extension for general non-Gaussian quadrature rules. The algorithm presented in this article is not an alternative for these existing algorithms, but embeds the Patterson extension in the discussed framework and can be used to determine all M nodes that can be added to a quadrature rule. If an efficient procedure to determine large numbers of Patterson extensions is available, it can be readily used to determine whether an extension for a specific M exists. By consecutively replacing the new nodes (see Section 3.2.3) all M nodes that can be added can be found.

Nested, positive, and interpolatory quadrature rule
Algorithm 4 provides a straightforward procedure to determine the minimal value of M and the positive interpolatory quadrature rule nodes X N+M such that X N ⊂ X N+M . The replacement procedure for M = 1 of Section 3.2.3 can be used to determine all possible nodes, given M. This is the original goal of the article as outlined in Section 2. 4 and examples of such quadrature rules are depicted in Fig. 6. Here, each quadrature rule is iteratively extended with a minimal number of nodes, and the nodes that are added are selected randomly from the set containing all M nodes that can be added. There are two main differences with the quadrature rules obtained in Section 3.3.2, where an existing rule was used as basis for a larger quadrature rule: the rules obtained in this section are fully nested, but do add more than one node between two consecutive rules. Both figures demonstrate that M varies significantly and does not increase monotonically. This is in line with the conclusions drawn in Section 4.2.3, as shown in Fig. 5. Moreover for almost all N, the value of M is significantly larger in case the Beta distribution is considered, which is related to the ''bad'' initial set of nodes for this distribution. A different initialization would lead to different values of M.

Numerical integration with positive quadrature rules
This article is concerned with the construction of quadrature rules with positive weights and two new quadrature rules have been introduced: one based on the consecutive replacement of single nodes (possibly resulting in a sequence of rules that is not nested) and one by randomly adding nodes ensuring positive weights. We briefly assess the numerical performance of these quadrature rules by means of the Genz test functions (see Table 1). The Genz test functions [32] are functions defined on Ω = [0, 1] constructed specifically to test integration routines. Each function has a specific family attribute that is considered to be challenging for integration routines, that can be enlarged by a shape parameter a and translated by a translation parameter b. We restrict ourselves to the uniform distribution, as in this case the exact value of the integral of the Genz functions is known analytically. Table 1 The test functions from Genz [32], which depend on the shape and translation parameters a and b.

Integrand family
Attribute

Discontinuous
We consider the performance of the following four quadrature rules: 1. A quadrature rule that is determined by consecutively adding and replacing nodes originating from a Gaussian quadrature rule (see Fig. 3(a)). This rule was discussed in Section 3.3 and is a partially nested, positive, and interpolatory quadrature rule. The rule is initialized with the quadrature rule nodes X N = {0, 5/12, 1} (i.e. the nodes from the example as discussed before, translated to [0, 1]).

2.
A quadrature rule that is determined by consecutively randomly adding M nodes to the rule such that the obtained rule is positive. Here M is minimal, i.e. the smallest number of nodes is added for each N (see Fig. 6(a)). This rule was discussed in Section 4.3 and is a nested, positive, and interpolatory quadrature rule. The rule is initialized in the same way as the quadrature rule of the previous point, i.e. using X N = {0, 5/12, 1}.
3. The Clenshaw-Curtis quadrature rule [15], where the nodes X N are defined explicitly by (2.5). It is well known that these nodes have positive weights if the distribution under consideration is uniform, which is the case. This positive and interpolatory quadrature rule is nested for specific levels, i.e. X N L ⊂ X N L+1 with N L = 2 L (l = 1, 2, . . . ). 4. The Gaussian quadrature rule [4], where the nodes and weights are defined as the quadrature rule with N +1 nodes of degree 2N + 1. This quadrature rule is not nested, so refining the quadrature rule results in a significant number of new function evaluations.
The error measure e N is the absolute integration error, i.e. where we use that µ 0 = 1 in our test cases. This error is determined using the algorithm of Remez [24,Chapter 3], with the implementation from chebfun [33]. Convergence results for the uniform distribution ρ ≡ 1 in Ω = [0, 1] are gathered in Fig. 7. Notice that regardless of the function under consideration all quadrature rule errors remain far under the dashed line, that represents the right-hand side of (5.1). This shows that the bound from this inequality is far from sharp.
The first four Genz functions can be approximated well using polynomials, as they are analytic and have rapidly converging Chebyshev coefficients. The best approximation converges exponentially in these cases, which is also the case for the four quadrature rules under consideration. The quadrature rules determined using the framework of this article perform slightly worse than the Clenshaw-Curtis and the Gaussian quadrature rule. This is related to the fact that these rules exploit the structure of the underlying distribution to a large extent (e.g. symmetry and higher-order moments), whereas the rules in this work only optimize for the positivity of the weights. The Gaussian quadrature rule converges with the highest rate, which is related to its high polynomial degree (a rule of N +1 nodes has degree 2N +1). However, the Gaussian rule is not nested, so to refine the estimate of the integral for increasing number of nodes the number of function evaluations increases significantly. If a computationally expensive function is considered, using a nested quadrature rule with fine granularity (such as the proposed rules) significantly reduces the cost of refining the quadrature rule estimate.
The fifth Genz test function is not differentiable and can therefore not be approximated well using a polynomial. This can be observed from the best approximation polynomial, that converges with order 1 (so we would expect that e N ∼ 1/N). In this case the difference between the Gaussian rule and the other rules is significantly smaller, demonstrating that the high polynomial degree of Gaussian rules is less relevant if the integrand is not smooth.
The sixth Genz test function cannot be approximated accurately using a polynomial when considering the ∞-norm, as it is discontinuous. Hence the best approximation error remains constant. However, the approximation of the quadrature rules still converges with order 1/2. In this case, there is a clear difference between the integration error (that is an averaged error) and the best approximation error (that is a uniform error).

Conclusion
In this article, a novel mathematical framework is presented for the construction of nested, positive, and interpolatory quadrature rules by using a geometrical interpretation. Given an existing quadrature rule, necessary and sufficient conditions have been derived for M new nodes to form an interpolatory quadrature rule with positive weights. The conditions have been formulated as inequalities, which are explicit if M = 1 and implicit if M > 1.
The addition of a single node can be treated as a special case, which can be solved analytically. The analytical expression can be used to add nodes to and replace nodes within a quadrature rule. The addition of multiple nodes can be determined numerically and a naive algorithm is presented for this purpose. Based on the quadrature rules obtained by this algorithm, the set that encompasses all additions of M nodes can be explored by iteratively replacing nodes.
The well-known Patterson extension of quadrature rules forms a special case of the framework, as it is obtained by constructing the quadrature rules with M weights equal to zero. As such, our proposed framework and its geometrical interpretation are well embedded in existing theory on the addition of nodes to quadrature rules. The framework provides various possibilities to construct or adapt quadrature rules and two examples have been discussed: one based on consecutively adding and replacing one node and one based on consecutively adding multiple nodes.
Numerical integration using the two quadrature rules introduced in this work shows the key advantages of nested quadrature rules with positive weights: estimates computed using the quadrature rules are stable and nesting allows for computationally cheap refinements of the estimates. Existing quadrature rules, such as the Gaussian and the Clenshaw-Curtis quadrature rule, are not nested with the fine granularity as the rules in this work.
There are various options to further extend the framework set out in this article. The algorithm to determine whether multiple nodes exist that can be added to the quadrature rule depends on determining many polynomial roots and iterates over all possible sequences of nodes that can become zero. For a large number of nodes this is computationally very costly and therefore warrants the need to derive an efficient algorithm to determine these nodes. Moreover the framework set out in this article does not use the relations that exists between consecutive moments of a distribution [34], which can possibly be used to further extend the framework set out in this text.